How to convert int to date in SQL Server 2008

前端 未结 5 922
情歌与酒
情歌与酒 2020-12-09 18:50

I am using MS SQL Server 2008, and in a table I have column idate as date but in the integer format. But in the query I want that in the date format. Is it possible to conve

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 19:33

    If your integer is timestamp in milliseconds use:

    SELECT strftime("%Y-%d-%m", col_name, 'unixepoch') AS col_name
    

    It will format milliseconds to yyyy-mm-dd string.

提交回复
热议问题