SQL Server 2008:

SELECT cast(AttDate as time) [time]
FROM yourtable

Earlier versions:

SELECT convert(char(5), AttDate, 108) [time]
FROM yourtable
Answer from t-clausen.dk on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › functions › cast-and-convert-transact-sql
CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn
Other values are processed as 0. Beginning with SQL Server 2012 (11.x), the only styles supported, when converting from date and time types to datetimeoffset, are 0 or 1.
🌐
GeeksforGeeks
geeksforgeeks.org › sql › sql-query-to-convert-datetime-to-date
SQL Query to Convert DateTime to Date in SQL Server - GeeksforGeeks
Here are four common and effective methods to convert DateTime to Date in SQL Server: The CAST() function in SQL Server is one of the most flexible functions available. It allows you to explicitly convert one data type to another, and it's perfect ...
Published   July 23, 2025
🌐
W3Schools
w3schools.com › sql › func_sqlserver_convert.asp
SQL Server CONVERT() Function
String Functions: Asc Chr Concat with & CurDir Format InStr InstrRev LCase Left Len LTrim Mid Replace Right RTrim Space Split Str StrComp StrConv StrReverse Trim UCase Numeric Functions: Abs Atn Avg Cos Count Exp Fix Format Int Max Min Randomize Rnd Round Sgn Sqr Sum Val Date Functions: Date DateAdd DateDiff DatePart DateSerial DateValue Day Format Hour Minute Month MonthName Now Second Time TimeSerial TimeValue Weekday WeekdayName Year Other Functions: CurrentUser Environ IsDate IsNull IsNumeric SQL Quick Ref · SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study
🌐
MSSQLTips
mssqltips.com › home › sql date format examples using convert function
SQL Date Format Examples using SQL CONVERT Function
September 26, 2025 - SQL Server provides a number of date and time formatting options and in this article we look at how to use SQL CONVERT to output different date/time formats such as mm/dd/yy, mm/dd/yyyy, dd-mm-yyyy, etc.
🌐
SQL Easy
sql-easy.com › learn › how-to-convert-datetime-to-date-in-sql-server
How to Convert DATETIME to DATE in SQL Server Effortlessly - SQL Knowledge Center
February 9, 2024 - Here are the common ways I’ve found effective: SELECT CAST(datetime_column AS DATE) FROM table_name; This method is straightforward and widely supported across different SQL databases.
🌐
Database Guide
database.guide › convert-datetime-to-time-in-sql-server-t-sql-examples
Convert 'datetime' to 'time' in SQL Server (T-SQL Examples)
+-------------------------+----------+ | datetime | time | |-------------------------+----------| | 2025-05-21 10:15:30.527 | 10:15:31 | +-------------------------+----------+ Here’s an example of an explicit conversion. In this case, I use the CAST() function directly within the SELECT statement ...
🌐
DB Vis
dbvis.com › thetable › extracting-time-and-date-in-ms-sql-server-a-comprehensive-guide
Extract Date and Time in MS SQL Server: A Complete Guide
February 7, 2025 - CAST is a straightforward function that changes one data type to another (e.g., datetime to date). CONVERT adds the ability to specify styles, which give you control over the format of the output string (e.g., yyyy-mm-dd, hh:mm:ss).If you only ...
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › data-types › datetime-transact-sql
datetime (Transact-SQL) - SQL Server | Microsoft Learn
UNION SELECT '01/01/2024 23:59:59.990', CAST('01/01/2024 23:59:59.990' AS DATETIME); Here's the result set. ... When you convert to date and time data types, the Database Engine rejects all values it can't recognize as dates or ...
🌐
DotFactory
dofactory.com › sql › convert-datetime-to-date
SQL Convert DATETIME to DATE
CONVERT converts the datetime value to a date format. A datetime includes both date and time whereas date only includes the date.
🌐
Database Star
databasestar.com › convert-datetime-to-date
How to Convert DATETIME to DATE in SQL Server | Database Star: Home
July 2, 2020 - The syntax for this is CONVERT (datetime, format). For example, to convert the current date and time into just a date: ... This shows the date only and no time. ... There are different ways you can use CAST, DATEDIFF, FLOOR, and CONVERT to get ...
🌐
SQLServerCentral
sqlservercentral.com › articles › combine-date-and-time-to-datetime2-in-sql-server
Combine DATE and TIME to DATETIME2 in SQL Server – SQLServerCentral
July 27, 2023 - DECLARE @OriginalDT DATETIME2 = '2023-12-31 23:59:59.9995000'; SELECT RoundedUp = CONVERT(DATETIME,DATETRUNC(ms,@OriginalDT));​ ... Like I said, we'll cover how to combine DATE and TIME datatype columns to DATETIME in a separate article.
🌐
SQL Server Tutorial
sqlservertutorial.net › home › sql server system functions › convert datetime to date
Convert Datetime to Date in SQL Server By Practical Examples
April 11, 2020 - The following example uses the CONVERT() function to convert a datetime to a date: SELECT CONVERT(DATE, GETDATE()) date; Code language: SQL (Structured Query Language) (sql)
🌐
Reddit
reddit.com › r/sqlserver › how i can convert from datetime to total hours?
r/SQLServer on Reddit: How i can convert from datetime to total hours?
April 4, 2021 -

I do this query and the result is a datetime, i try so much variants, but nothing work it... I want the result to be displayed in the number of total hours, like (in this case): 25:01:05 because i have 2 days en this datetime, I have had results like 01:01:05 which is when it only subtracts the hours from the datetime. I would like that as well as add the hours by the number of days, do it with the months if it can be

🌐
C# Corner
c-sharpcorner.com › article › convert-datetime-to-different-formats-in-sql-server
Mastering the Art of Convert DateTime Formats In SQL Server with Over 30 Code Examples
October 4, 2023 - Here we will use the "CONVERT" function to convert a datetime into a different format in SQL Server. By using some built-in function in SQL Server, we can get the datetime value in a specific format.
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › convert-datetime-to-just-time-only-hour
Convert datetime to just time (only hour) – SQLServerCentral Forums
September 26, 2008 - I have one datetime column named Hours in SQL Server Table1, which gives the output as 09/26/2008 01:00:00, 09/26/2008 02:00:00, 09/26/2008 03:00:00 till 09/26/2008 12:00:00 format. I wanted to get just the year in int datatype from this format and I got it using (SELECT CONVERT(int, YEAR (Hours)) AS Year FROM Table1) and I am getting the correct Year as I wanted 2008.
🌐
SQLines
sqlines.com › sql-server-to-mysql › functions › convert_datetime
SQL Server CONVERT for Datetime in MySQL - SQLines Tools
In SQL Server, you can use CONVERT function to convert a string with the specified format to a DATETIME value. In MySQL, you can use STR_TO_DATE function if you need a specific format, or CONVERT if you need the default format. Note that the order of parameters in SQL Server and MySQL CONVERT ...