douchun5976 2011-01-25 13:39
浏览 154
已采纳

在PHP中将Unix纪元时间戳转换为MySQL时间戳

I have an issue whereby a client has some legacy environment (IIS 6 / PHP 5.0.1) and keeps getting the following error:

Warning: date() [function.date]: Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in" when using the date() function.

I need to find a way to convert my UNIX timestamp, i.e "1293559200" (28th of Dec, 2010) to something I can then pass on as a correct date.

  • 写回答

1条回答 默认 最新

  • douxuelv7755 2011-01-25 13:43
    关注
    SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y-%m-%d %H:%i:%s');
    

    Where you can replace UNIX_TIMESTAMP() with your timestamp value.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?