Date format from MSSQL to other

2019-08-31 16:31发布

In MSSQL I have columns with date (only date, without time). It was saved with this function:

ROUND(CAST(GETDATE() AS REAL), 0, 1) + 36163 **(ex. 77009)**

How I can format this date (month etc.) with PHP, MySQL or even MSSQL.

For example: 77009 = 2011-11-01.

2条回答
迷人小祖宗
2楼-- · 2019-08-31 17:00

For Sql Server SELECT CONVERT(DateTime,XXX-36163)

eg. SELECT @val = ROUND(CAST(GETDATE() AS REAL), 0, 1) + 36163 SELECT CONVERT(DateTime,@val-36163)

查看更多
聊天终结者
3楼-- · 2019-08-31 17:20

MySQL:

SELECT SEC_TO_TIME(YOUR_DATE_COLUMN);

Please refer to the function in MySQL docs

查看更多
登录 后发表回答