logo
Published on GreenAsh (http://www.greenash.net.au)

Aussie Daylight Savings PHP function

By Jaza
Created 27 Mar 2005 - 11:04pm

Want to know how the GreenAsh clock always tells you, with perfect accuracy, the time in Sydney Australia? Our secret is a little PHP function that modifies the clock according to the rules of NSW Daylight Savings Time. No, in case you were wondering, we don't stay up until 2am twice each year, ready to change the site's time zone configuration at exactly the right moment! A simple little bit of programming does that for us. And unlike a human, computer code doesn't fall asleep waiting for the clock to tick over.

The function that we use is based on the rules of NSW Daylight Savings Time, as explained at Lawlink's Time in NSW [1] page (they also have another excellent page that explains the history of Daylight Saving in NSW [2], for those that are interested). The current set-up for Daylight Saving is as follows:

And that's really all there is to it! So without further ado, I present to you the PHP function that GreenAsh uses in order to calculate whether or not it is currently GPL [3]-like things with it, the code is yours to play with!


Source URL:
http://www.greenash.net.au/posts/thoughts/aussie-daylight-savings-php-function