timezone problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

timezone problems

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: timezone problems

Post by requinix »

What if you use "Ymd h:i:s a e" as the format string?
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: timezone problems

Post 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.
Post Reply