Date format from MSSQL to other

僤鯓⒐⒋嵵緔 提交于 2019-12-11 16:49:10

问题


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.


回答1:


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

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




回答2:


MySQL:

SELECT SEC_TO_TIME(YOUR_DATE_COLUMN);

Please refer to the function in MySQL docs



来源:https://stackoverflow.com/questions/9483942/date-format-from-mssql-to-other

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!