xxreenaxx1 Posted April 29, 2010 Share Posted April 29, 2010 Hey I am trying to display time on my login page, the problem is that the time is wrong for london. Currently in london its 8.30pm. But it displays 1.00am.. why is this? # <?php $_SESSION['loggedin'] = time (); session_start(); date_default_timezone_set('Europe/London'); print '<p> blah blah ;'.date('g:i a', $_SESSION['loggin']).'<p>'; ?> Link to comment https://forums.phpfreaks.com/topic/200209-php-timezone-for-london/ Share on other sites More sharing options...
teamatomic Posted April 29, 2010 Share Posted April 29, 2010 Try: date_default_timezone_set('Europe/London'); if that does not work, needs php>=5.1 do it with the offset $offset =+1; $date = gmdate('h:i:s', time()+$offset*60*60); HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/200209-php-timezone-for-london/#findComment-1050755 Share on other sites More sharing options...
salathe Posted April 30, 2010 Share Posted April 30, 2010 Set the timezone before you use any function that will make use of it (e.g. time()). Link to comment https://forums.phpfreaks.com/topic/200209-php-timezone-for-london/#findComment-1050897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.