Reputation: 129
I want to get only Time from a DateTime column using SQL query using SQL Server 2012:
The datetime format in the column at the moment is:
dd/mm/yyyy hh:mm
example - 16/10/2018 11:50
I want to extract the hh:mm and convert the column to a time format (hh:mm or hh:mm:ss)
Any assistance would be much appreciated.
Thanks.
Upvotes: 9
Views: 37176
Reputation: 1269763
If the column is a string, do you simply want this?
select convert(time, right(col, 5))
Upvotes: 7