How to show easten Australian time?

More
14 years 10 months ago #1147 by leemo2000
How do I adjust the script to show eastern Australian (Sydney) time?

The date stamp I am getting at the moment is for Pacific US.

Cheers
Lee

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1151 by Pete
Hello leemo,

The existing date and time reflects the date and time of the location of your webserver / webhost:
Code:
$date = date("D m/j/y g:iA");

What you have to do is to determine exactly how many hours that date and time is off from Australian time, and then subtract it from the date and time on the server before storing messages.
Code:
$date = date("D m/j/y g:iA"); $date = strtotime($date) + 50400;

The value of "50400" was obtained from the following table (assumed central australia):
Code:
-25200|International Date Line (West) GMT-12| -21600|Midway Island, Samoa GMT-11| -18000|Hawaii, Honolulu GMT-10| -14400|Alaska GMT-9| -10800|Pacific Standard Time, US, Canada GMT-8| -7200|British Columbia N.E., Santa Fe, Mountain Time GMT-7| -3600|Central America, Chicago, Guatamala, Mexico City GMT-6| 0|US, Canada, Bogota, Boston, New York GMT-5| +3600|Canada, Santiago, Atlantic Standard Time GMT-4| +7200|Brazilia, Buenos Aires, Georgetown, Greenland GMT-3| +10800|Mid-Atlantic GMT-2| +14400|Azores, Cape Verde Is., Western Africa Time GMT-1| +18000|London, Iceland, Ireland, Morocco, Portugal GMT| +21600|Amsterdam, Berlin, Bern, Madrid, Paris, Rome, GMT+1| +25200|Athens, Cairo, Cape Town, Finland, Greece, Israel GMT+2| +28800|Ankara, Aden, Baghdad, Beruit, Kuwait, Moscow GMT+3| +32400|Abu Dhabi, Baku, Kabul, Tehran, Tbilisi, Volgograd GMT+4| +36000|Calcutta, Colombo, Islamabad, Madras, New Dehli GMT+5| +39600|Almaty, Dhakar, Kathmandu, Colombo, Sri Lanka GMT+6| +43200|Bangkok, Hanoi, Jakarta, Phnom Penh, Australia GMT+7| +46800|Taipei, Beijing, Hong Kong, Singapore, GMT+8| [b]+50400|Seoul, Tokyo, Central Australia GMT+9|[/b] +54000|Brisbane, Canberra, Guam, Melbourne, Sydney, GMT+10| +57600|Magadan, New Caledonia, Solomon Is. GMT+11| +61200|Auckland, Fiji, Kamchatka, Marshall, Wellington, GMT+12|

You may need to tweak it slightly depending on your location in Australia.

Pete

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1152 by leemo2000
Thanks Pete,

I tried adding the code:

$date = strtotime($date) + 50400;
into the add.php but when I run the script now I am getting an error message (unexpected echo).

Cheers
Lee

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1155 by Pete
Sorry, try a slight variation of that:
Code:
$date = date("D m/j/y g:iA"); $time = 50400; $datetime = strtotime($date) + $time; $date = date('M d, Y h:i A', $datetime);

This should work assuming you have PHP version 5.1.0 or higher.

Pete

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #1158 by leemo2000
Works perfectly, thanks again Pete.

Lee

Please Log in or Create an account to join the conversation.

Time to create page: 0.121 seconds
Powered by Kunena Forum