I am using strtotime
function with 28th October, 2014 date like echo strtotime('2014-10-28')
on local and staging servers.
Local server result: 1414468800
Staging server result: 1414425600
Why there is difference between the results on different servers and how can I fix this issue?
i think it is because the two servers have diff timezones..
you can atleast do this:
$date = '2014-10-28'; // date
$timezone = 'America/Virgin'; // timezone you prefer
$date = new DateTime($date , new DateTimeZone($timezone));
echo $date->getTimestamp();
You can set the timezone in your php.ini
file. The value is
date.timezone = "Americas/New_York"
I think this values are different on your systems.
Otherwise you have to set it in your scripts but i think its better to set it in your configuration.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.