Page 1 of 1

timezone problems

Posted: Fri Nov 20, 2009 1:40 pm
by yacahuma
i am running vista 64 with apache

my pc clock says 3:37pm, time zone GMT -4

when I run the following script I get
TZ=Etc/GMT-4
20091120 11:37:13 pm

Code: Select all

 
$script_tz = date_default_timezone_get();
echo '<BR>TZ=' . $script_tz;
echo '<BR>' . date("Ymd h:i:s a");
 
Why am I getting 11 instead of 3????

thank you

Re: timezone problems

Posted: Fri Nov 20, 2009 3:30 pm
by requinix
What if you use "Ymd h:i:s a e" as the format string?

Re: timezone problems

Posted: Fri Nov 20, 2009 5:33 pm
by yacahuma
Thank you.

I had to set my time zone like this

Code: Select all

 
date_default_timezone_set('America/Puerto_Rico');
 
I was reading in php bugs and apparently something changed after 5.1. Also If I just set the time zone in php.ini using strict I will get a warning. So apparently the only way of not getting the warning is by usiong this function.