donglv6747 2014-08-05 16:02
浏览 31
已采纳

在Linux上的PHP日期和时间的奇怪问题

i've search a lot but i could not find an answer to this problem. I've set correctly the timezone on the server and for php. As i use "date" commmand on the server it gives me the right answer. But if i use this PHP script:

<?php
// include 'cal_config.php';
// include 'cal_matchclass.php';

// $_mail = $_GET["mail"];

$dataTime = date("Y-m-d H:i:s");
echo $dataTime;
echo "
".date_default_timezone_get();

?>

the date/time it shows me is 6 hours later! but the timezone is correct (in this case it is Europe/Rome).

Anyone has some suggestions? Pls help because i really cannot understand what's wrong as i set all things right. Thanks all.

This is the output from "date" command on linux:

mar  5 ago 2014, 18.06.15, EDT

And this is the output from the above php script:

2014-08-06 00:06:12
Europe/Rome
  • 写回答

1条回答 默认 最新

  • dtja73027 2014-08-05 16:11
    关注

    EDT = Eastern Daylight Time (UTC - 4 hours)

    Europe/Rome = +2.0 hours

    Their time sum gives you exactly six hours difference.

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

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置