Time part of a DateTime Field in SQL

后端 未结 11 1644
小蘑菇
小蘑菇 2020-12-03 04:39

How would I be able to extract the time part of a DateTime field in SQL? For my project I have to return data that has a timestamp of 5pm of a DateTime field no matter what

11条回答
  •  情深已故
    2020-12-03 04:56

    select cast(getdate() as time(0))

    returns for example :- 15:19:43

    replace getdate() with the date time you want to extract just time from!

提交回复
热议问题