How to cast the DateTime to Time

后端 未结 3 843
我寻月下人不归
我寻月下人不归 2020-11-22 02:52

I am casting DateTime field to Time by using CAST Syntax.

select CAST([time] as time) as [CSTTime]

DateTime

3条回答
  •  面向向阳花
    2020-11-22 02:53

    You can achieve it with CAST just simple use TIME(0) datatype in following:

    SELECT CAST('2015-03-19 01:05:06.289' AS TIME(0))
    

    OUTPUT:

    01:05:06

提交回复
热议问题