Forum Moderators: coopster

Message Too Old, No Replies

PHP Time offset

Daylight saving for GMT time display

         

abbeyvet

2:05 pm on Feb 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to display the current time in GMT on a site, to avoid people at the opposite end of the world calling at 3am!

Currently I am using this:

<?php
echo 'The current time in Ireland is: ' . gmdate('g.h a') . '<br />';
?>

But is an hour behind the actual time because of daylight saving. How can I correct this?

Thanks

vevs

9:52 pm on Feb 8, 2006 (gmt 0)

10+ Year Member



try this
<?
$onehourahead = time()+3600;
echo gmdate("H:i", $onehourahead);
?>

it adds 1 hour to the current GMT time

abbeyvet

10:11 pm on Feb 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perfect. Thank you.

eeek

10:35 pm on Feb 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is there something wrong with using the date function?