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 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳