We use very simple php function to display time and date.
<div class="datedata"><?=date("l, F jS, Y", time());?></div>
But I was thinking how would I display the actual time in differennt Australian States.
I used to know the script for displaying the time of our server, which is in nsw but forgot it. Guess that would be easiest.. display server time and then show diff times based on server time + / – 1 hr whatever…
Wonder if anyones got any suggestions..
Cheers
With @crolpa help this is what I have, like i said .. im crap with php.
<?php
date_default_timezone_set('Australia/Adelaide');
$adelaide = time();
date_default_timezone_set('Australia/Melbourne');
$melbourne = time();
date_default_timezone_set('Australia/Sydney');
$sydney = time();
//etc...
?>
<?=date("G:i a",$adelaide)?><br />
<?=date("G:i a",$melbourne)?><br />
<?=date("G:i a",$sydney)?><br />
You can add the offsets to the base time. So..
The default
time()function is set by your server. You can change this easily with at the beginning of your script:This can also be used through your script to simulate different timezones.
This is the easiest way, that will also adjust automatically with daylight savings: