Time zone

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
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Time zone

Post by shivam0101 »

How do i get current CST AST EST MST PST time including daylight informations
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

have a look at the time(), mktime(), date(), gmdate() and related functions in the manual
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Okay. And what have you tried so far? scottayy gave you a few very useful functions.
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Post 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.
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

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