Working with Timezones and DST

This is a discussion on Working with Timezones and DST within the PHP Language forums, part of the PHP Programming Forums category; Hello everyone. I am creating a JavaScript project which will allow users to see what time it is in other ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-27-2007
Daz
 
Posts: n/a
Default Working with Timezones and DST

Hello everyone.

I am creating a JavaScript project which will allow users to see what
time it is in other countries. I am wondering if there's any way to
have the server work this out, without having to update a database
constantly with the times and dates that certain countries set their
clocks back or forward.

Can this be done, or do I need to connect to a time server? Ideally, I
need a time server that will return a JavaScript object containing the
information I need, but I don't think one exists.

Please could someone suggest the steps I need to take to quickly
obtain the correct time for any given country, which will take DST
into account? Sadly, to my knowledge, the UK is the only country that
has hard-coded rules for when the clocks are changed, where as it
seems to be a political thing for all other countries.

If I have to run a database with this information, then so be it, but
it seems like a lot of manual work, and I'm not sure how often I'd
need to update it.

Many thanks in advance.

Daz.

Reply With Quote
  #2 (permalink)  
Old 05-27-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Working with Timezones and DST

Daz wrote:
> Hello everyone.
>
> I am creating a JavaScript project which will allow users to see what
> time it is in other countries. I am wondering if there's any way to
> have the server work this out, without having to update a database
> constantly with the times and dates that certain countries set their
> clocks back or forward.
>
> Can this be done, or do I need to connect to a time server? Ideally, I
> need a time server that will return a JavaScript object containing the
> information I need, but I don't think one exists.
>
> Please could someone suggest the steps I need to take to quickly
> obtain the correct time for any given country, which will take DST
> into account? Sadly, to my knowledge, the UK is the only country that
> has hard-coded rules for when the clocks are changed, where as it
> seems to be a political thing for all other countries.
>
> If I have to run a database with this information, then so be it, but
> it seems like a lot of manual work, and I'm not sure how often I'd
> need to update it.
>
> Many thanks in advance.
>
> Daz.
>


And what are you going to do with the United States, which has six time
zones (and some not everyone observes DST). Or Russia, which has eight
time zones?

In the U.S., everyone who participates does so on the same day. But not
everyone has to participate.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #3 (permalink)  
Old 05-27-2007
Daz
 
Posts: n/a
Default Re: Working with Timezones and DST

On May 27, 3:31 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Daz wrote:
> > Hello everyone.

>
> > I am creating a JavaScript project which will allow users to see what
> > time it is in other countries. I am wondering if there's any way to
> > have the server work this out, without having to update a database
> > constantly with the times and dates that certain countries set their
> > clocks back or forward.

>
> > Can this be done, or do I need to connect to a time server? Ideally, I
> > need a time server that will return a JavaScript object containing the
> > information I need, but I don't think one exists.

>
> > Please could someone suggest the steps I need to take to quickly
> > obtain the correct time for any given country, which will take DST
> > into account? Sadly, to my knowledge, the UK is the only country that
> > has hard-coded rules for when the clocks are changed, where as it
> > seems to be a political thing for all other countries.

>
> > If I have to run a database with this information, then so be it, but
> > it seems like a lot of manual work, and I'm not sure how often I'd
> > need to update it.

>
> > Many thanks in advance.

>
> > Daz.

>
> And what are you going to do with the United States, which has six time
> zones (and some not everyone observes DST). Or Russia, which has eight
> time zones?
>
> In the U.S., everyone who participates does so on the same day. But not
> everyone has to participate.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


Absolutely nothing! Hehe. Unless of course you have a suggestion. I
cannot do the impossible. I am quite sure that this problem can be
overcome, however. I was under the impression that the PHP timezones
would take care of it. Would it not?

Reply With Quote
  #4 (permalink)  
Old 05-27-2007
Aerik
 
Posts: n/a
Default Re: Working with Timezones and DST

I've seen (and am using) an alternate syntax to get the time in
different zones - I don't really know what's going on "under the hood"
but thought I'd mention it. What works on the server I'm using (linux
of unknown flavor, PHP 4.3) is setting the environment to be
"EST5EDT4" etc.

Aerik


Reply With Quote
  #5 (permalink)  
Old 05-27-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Working with Timezones and DST

Daz wrote:
> On May 27, 3:31 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Daz wrote:
>>> Hello everyone.
>>> I am creating a JavaScript project which will allow users to see what
>>> time it is in other countries. I am wondering if there's any way to
>>> have the server work this out, without having to update a database
>>> constantly with the times and dates that certain countries set their
>>> clocks back or forward.
>>> Can this be done, or do I need to connect to a time server? Ideally, I
>>> need a time server that will return a JavaScript object containing the
>>> information I need, but I don't think one exists.
>>> Please could someone suggest the steps I need to take to quickly
>>> obtain the correct time for any given country, which will take DST
>>> into account? Sadly, to my knowledge, the UK is the only country that
>>> has hard-coded rules for when the clocks are changed, where as it
>>> seems to be a political thing for all other countries.
>>> If I have to run a database with this information, then so be it, but
>>> it seems like a lot of manual work, and I'm not sure how often I'd
>>> need to update it.
>>> Many thanks in advance.
>>> Daz.

>> And what are you going to do with the United States, which has six time
>> zones (and some not everyone observes DST). Or Russia, which has eight
>> time zones?
>>
>> In the U.S., everyone who participates does so on the same day. But not
>> everyone has to participate.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================

>
> Absolutely nothing! Hehe. Unless of course you have a suggestion. I
> cannot do the impossible. I am quite sure that this problem can be
> overcome, however. I was under the impression that the PHP timezones
> would take care of it. Would it not?
>


The time zone will be the time zone for your server. There is no way
for you to tell what the timezone on my machine is.

Your best bet is to just ask them what timezone they are in, and whether
or not to adjust for dst.

As for the dates of when to start/stop. I don't have any good
recommendations there. I suspect the timezones would set it
appropriately - but there are way too many to be usable, IMHO.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #6 (permalink)  
Old 05-27-2007
Daz
 
Posts: n/a
Default Re: Working with Timezones and DST

On May 27, 8:13 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Daz wrote:
> > On May 27, 3:31 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> Daz wrote:
> >>> Hello everyone.
> >>> I am creating a JavaScript project which will allow users to see what
> >>> time it is in other countries. I am wondering if there's any way to
> >>> have the server work this out, without having to update a database
> >>> constantly with the times and dates that certain countries set their
> >>> clocks back or forward.
> >>> Can this be done, or do I need to connect to a time server? Ideally, I
> >>> need a time server that will return a JavaScript object containing the
> >>> information I need, but I don't think one exists.
> >>> Please could someone suggest the steps I need to take to quickly
> >>> obtain the correct time for any given country, which will take DST
> >>> into account? Sadly, to my knowledge, the UK is the only country that
> >>> has hard-coded rules for when the clocks are changed, where as it
> >>> seems to be a political thing for all other countries.
> >>> If I have to run a database with this information, then so be it, but
> >>> it seems like a lot of manual work, and I'm not sure how often I'd
> >>> need to update it.
> >>> Many thanks in advance.
> >>> Daz.
> >> And what are you going to do with the United States, which has six time
> >> zones (and some not everyone observes DST). Or Russia, which has eight
> >> time zones?

>
> >> In the U.S., everyone who participates does so on the same day. But not
> >> everyone has to participate.

>
> >> --
> >> ==================
> >> Remove the "x" from my email address
> >> Jerry Stuckle
> >> JDS Computer Training Corp.
> >> jstuck...@attglobal.net
> >> ==================

>
> > Absolutely nothing! Hehe. Unless of course you have a suggestion. I
> > cannot do the impossible. I am quite sure that this problem can be
> > overcome, however. I was under the impression that the PHP timezones
> > would take care of it. Would it not?

>
> The time zone will be the time zone for your server. There is no way
> for you to tell what the timezone on my machine is.
>
> Your best bet is to just ask them what timezone they are in, and whether
> or not to adjust for dst.


Or I can use JavaScripts Date() object... It's not 100% accurate, but
neither is asking them.

> As for the dates of when to start/stop. I don't have any good
> recommendations there. I suspect the timezones would set it
> appropriately - but there are way too many to be usable, IMHO.


Thanks for your comments. I think I will use JavaScript to make an
educated guess, and give them the option to change it if it's
incorrect.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:32 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0