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.

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

报告相同问题?

悬赏问题

  • ¥15 请问各位,如何在Jetson nano主控板的Ubuntu系统中安装PyQt5
  • ¥15 MAC安装佳能LBP2900驱动的网盘提取码
  • ¥400 微信停车小程序谁懂的来
  • ¥15 ATAC测序到底用什么peak文件做Diffbind差异分析
  • ¥15 安装ubantu过程中第一个vfat 文件挂载失败
  • ¥20 GZ::CTF如何兼容一些靶机?
  • ¥15 etcd集群部署问题
  • ¥20 谁可以帮我一下问一下各位
  • ¥15 为何重叠加权后love图的SMD与svyCreateTableOne函数绘制基线表的不一致
  • ¥150 求 《小魔指》街机游戏机整合模拟软件