Click to See Complete Forum and Search --> : [RESOLVED] Weird PHP Time


cancer10
10-07-2008, 09:40 AM
Hi,

I am using windows XP and running a local server on my PC.

I am using the following PHP code to generate the current System time:

<?php echo date("g:i a", time()) ;?>

To my surprise, I see the output as 2:36 pm where as my localtime is 8:08 PM

Why is there approx 6.3 hrs of difference b/w my system time and my local server time?


Any help will be appreciated

Thanx

TheBearMay
10-07-2008, 10:10 AM
May need to specify your time zone prior, i.e.:


putenv("TZ=America/New_York");

cancer10
10-07-2008, 10:55 AM
ok seems i have found a solution:

<?php putenv("TZ=Asia/Calcutta");echo date("d M, Y g:i a");?>


Thanx mate