PHP insists on a wrong timezone
Here is a script with the output of each line in a comment next to each
statement to demonstrate my problem
<?php
echo date_default_timezone_get(); //Europe/Helsinki
date_default_timezone_set('Africa/Cairo');
$script_tz = date_default_timezone_get();
if (strcmp($script_tz, ini_get('date.timezone'))){
echo "\nScript timezone differs from ini-set timezone."; //True,
this block is ran
} else {
echo "\nScript timezone and ini-set timezone match.";
}
echo "\n".date_default_timezone_get(); //Africa/Cairo
echo "\n'".ini_get('date.timezone')."'"; //''
echo "\n".date('Z'); //10800
echo "\n".date("m/d/Y h:i:s A T",strtotime("-1 hour")); //I still have
to do this to obtain the correct date !
?>
I'm in Cairo where we no longer have DST for around 3 years now. The
server's timezone is set correctly and DST option isn't even available to
enable or disable DST. So it is inherently disabled. Here is a screenshot
to demonstrate
In my php.ini file
[Date]
; Defines the default timezone used by the date functions
;date.timezone =
So why do still have to manipulate the date() output (i.e. reducing it by
one hour) to get the correct time which matches the server time ?
And why does it insist that Europe/Helsinki is my timezone ?
No comments:
Post a Comment