Jerin_T Jerin_T - 5 months ago 33
SQL Question

Convert to HH:MM in SQL Server

I would like to convert a date time format to

using SQL Server.

For example: convert this value
2017-08-17 15:31:18.217

If anyone knows how to do this, please help.

Answer Source

Here is one way to do it:

DECLARE @DateTime datetime = '2017-08-17 15:31:18.217'

SELECT CONVERT(char(5), @DateTime, 108)

Result: 15:31