duanaigua4033 2011-04-17 13:46
浏览 31

小时不输出正确

I am using Wanp as a testing server. Here is my code:

$dt = time();
$mysql_datetime = strftime("%Y-%m-%d %H:%M:%S %p %z" , $dt);
echo $mysql_datetime;

Here is the output:

2011-04-17 01:36:55 PM Eastern Standard Time

My problem is that, all the information is correct except or the hour, which is 4 hours ahead. The hour (01 PM) is suppose to be (09 AM). I have checked my date and time on my computer, and the time zone is correct. What would cause this to happen, please help.

  • 写回答

3条回答 默认 最新

  • doumou5109 2011-04-17 13:50
    关注

    Chances are this is due to the timezone being set incorrectly. (Although it's odd that the %z is correct, which I'm presuming it is.)

    Have you tried calling date_default_timezone_set with the appropriate timezone value?

    评论

报告相同问题?

悬赏问题

  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch