Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Daylight saving calculation 1

Status
Not open for further replies.

JimFL

Programmer
Jun 17, 2005
131
GB
Hi,

I have to pass several timestamps into a flash presentation for different locations around the world. I am able to do this fine for the UK,Tokyo & Sydney as I dont think they are effected by daylight saving. However I have to do this for New York I have to think about Daylight saving.


I am using a UK time local on our server.

This is my code so far but it is not working out the daylight saving.



$timestamp_uk = explode(" ",microtime());
$timestamp_uk = round(($timestamp_uk[1] + $timestamp_uk[0])*1000); // GMT server Timestamp in milliseconds

$timestamp_ny = $timestamp_uk -(1000*60*60*5); // set a (your local) time zone offset for each
$timestamp_tk = $timestamp_uk +(1000*60*60*9);
$timestamp_sy = $timestamp_uk +(1000*60*60*11);


Can anybody help or does anybody have an effective solution for this issue.

JimFl

 
Before you get too complacent - both the UK and Australia have daylight saving... I don't know about Japan.

Maybe it's possible to visit an online time server using your php script - and pick up all the times from there.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Ok I have checked out the site but cant find anything on the site to work out a way read from their servers to get accurate times for different locations.

Do you know how ?

 
According to this site, the U.K. and those parts of Australia which include Sydney (the states of South Australia, New South Wales, Victoria, and Tasmania) do observer DST.

The fun part is that if you need to be able to programmatically make those adjustments on any given date, you'll also need to know when various places go on and off DST, as there's no international standard.

Keep in mind, too, that once a country decides to observe DST, the dates when it happens aren't necessarily carved in stone either. The U.S., for example, defines the start of DST to be the 2:00am on the first Sunday in April and in 2007, the U.S. will change the dates on which it moves to DST to the second Sunday in March. (see
How often are you going to have to recalculate these times?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Firstly, as I am using a UK server to calculate the time then both the UK and Australian Daylight saving times will apply at the same time on the server that I am using. There maybe a slight inconsistency for Australia but this doesnt matter too much.

The important calculation for me is the US Daylight saving which will need to be made twice a year at different times.

I am just a bit confused as to how this has been done before by other people.

Will I have to get a list from the above site and then hard code each instance of when the daylight saving must be calculated.

ie. some thing this.

On 2:00am on the first Sunday in April then apply a rule then
2:00am on the first Sunday in April of the next year then apply another rule.

Im really lost.
Can anybody help that has dealt with this issue before?

 
Ok thanks thats whats along the lines of what I have been looking for. It will certainly help to put me on the right track.

Surprised I didnt find it. Thanks for your assistance.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top