Truncate Datetime to Second (Remove Milliseconds) in T-SQL

后端 未结 8 1479
庸人自扰
庸人自扰 2020-12-01 08:59

What is the best way to shorten a datetime that includes milliseconds to only have the second?

For example 2012-01-25 17:24:05.784 to 2012-01-25

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 09:39

    so, the easiest way now is:

    select convert(datetime2(0) , getdate())

提交回复
热议问题