Convert seconds to datetime in SQL Server

后端 未结 3 445
悲&欢浪女
悲&欢浪女 2021-01-18 11:32

How to convert seconds to datetime? I try this, but results are not correct:

CONVERT(datetime, DATEADD(ms, dateTimeInSeconds, 0))
3条回答
  •  北荒
    北荒 (楼主)
    2021-01-18 11:45

    Given your example, try this:

    select DATEADD(s, dateTimeInMilliseconds, '19700101')
    

提交回复
热议问题