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 OverflowVideos
I'm currently using the query below to convert eastern time to UTC:
Convert(datetime,CreationTime, AT TIME ZONE 'Easterm Standard Time' AT TIME ZONE 'UTC')
How can I use this query and convert it to the time format below?
YYYYMMDD-HH:MM:SS.000
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
Tysss I have made a demo for you please try this, Here I have used GETDATE() for return current date with a timestamp where you have to pass your column name as you showed in the question which is TimeStamp.
SOLUTION 1
SELECT CAST(CONVERT(VARCHAR,GETDATE(),110) AS DATE) AS DATE
OUTPUT
2019-05-17
SOLUTION 2
SELECT CAST(CONVERT(VARCHAR,GETDATE(),110) AS DATETIME) AS DATE
OUTPUT
2019-05-17 00:00:00.000
I think you need the only date from TimeStamp so, you need to change the datatype DATE else if you will keep your datatype DATETIME then it will return date something like 2019-05-17 00:00:00.000
select GETDATE() as TimeStamp,
convert(date, getdate()) as date

For SQL Server 2005 and below:
CopyCONVERT(varchar(8), @ParamDate, 112) -- Supported way
CAST(FLOOR(CAST(@ParamDate AS float)) AS DATETIME) -- Unsupported way
For SQL Server 2008 and above:
CopyCAST(@ParamDate AS DATE)
For SQL Server 2022 and above:
CopyDATETRUNC(d, @ParamDate)
Copydeclare @originalDate datetime
select @originalDate = '2009-06-24 09:52:43.000'
declare @withoutTime datetime
select @withoutTime = dateadd(d, datediff(d, 0, @originalDate), 0)
select @withoutTime