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 matlab求解平差
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法