Timezones

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
mistaking
Forum Newbie
Posts: 2
Joined: Mon Oct 21, 2002 9:39 am

Timezones

Post by mistaking »

I am currently developing a calendar/scheduler using php, the problem is the client has sites worldwide.
There fore the dates all need to be adjusted according to country etc.
Is there a function in php to find which timezone the user is in? and to take into account their timezone, and therefore the correct date?

Any help woul;d be greatly appreciated.
f1nutter
Forum Contributor
Posts: 125
Joined: Wed Jun 05, 2002 12:08 pm
Location: London

Post by f1nutter »

Just a guess.

PHP is server side, so will return you servers time. If your clients are world wide, then you need something client side to get their local time, maybe javascript, and then use this to calculate your dates. Maybe use getTimezoneOffset in javascript, but I've never used it myself.

Good luck.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

AFAIK the only way in PHP to work out someone's timezone is to ask them and then store and use that value (like this forum does).

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

mistaking
Forum Newbie
Posts: 2
Joined: Mon Oct 21, 2002 9:39 am

Post by mistaking »

is there an environmental variable that returns the date/time? like $_ENV and $HTTP_ENV_VARS
DeGauss
Forum Contributor
Posts: 105
Joined: Tue Oct 22, 2002 9:44 am
Location: Gainesville, FL

Post by DeGauss »

read up on using mktime with date. The best example is on php.net.

Also, there's a switch for the date function that deals with timezones... But i'll be buggered if i ever deal with timezones.
shokk
Forum Newbie
Posts: 8
Joined: Wed Oct 22, 2003 5:35 pm

Post by shokk »

twigletmac wrote:AFAIK the only way in PHP to work out someone's timezone is to ask them and then store and use that value (like this forum does).

Mac
So there is no internal calculation for
"what time is it now in PST8PDT"
or
"what time is it now in RSTKDT"?
based on your current timezone setting?
I was hoping to add a world clock to my site, but such that it would be more portable for making into a MOD.
Post Reply