Page 1 of 1

Time zone

Posted: Sat Sep 29, 2007 12:53 am
by shivam0101
How do i get current CST AST EST MST PST time including daylight informations

Posted: Sat Sep 29, 2007 1:07 am
by s.dot
have a look at the time(), mktime(), date(), gmdate() and related functions in the manual

Posted: Sat Sep 29, 2007 1:36 am
by shivam0101
The admin will put a future date and time as event date. It will be in one of the format from PST, EST etc... depending on where the event occurs. I have to display the counter.

taking into account of daylight time how to calculate number of seconds

Posted: Sat Sep 29, 2007 4:13 pm
by superdezign
Okay. And what have you tried so far? scottayy gave you a few very useful functions.

Posted: Sun Sep 30, 2007 10:23 pm
by shivam0101
superdezign,
I am thinking of getting gmt time and then subtracting appropriate number of hours (for EST -5, CST - 6 ect..). But, how to handle daylight savings.

Posted: Mon Oct 01, 2007 1:22 am
by jeffery
Get the current timezone (date_default_timezone_get), try setting the time zone to what you want using the date_default_timezone_set function to retrieve the correct time in that time-zone and then reste the timezone to what it was. I haven't tested this but in theory I think it should work.