How to output a MySQL UTC timestamp field to correct local time with daylight saving with PHP?
Local time is set in php.ini with: date.timezone = "Europe/London"
Confirmed set with: <?php echo date_default_timezone_get(); ?>
But when I echo the timestamp field it does not display correct UK time for the record (an hour behind correct UK time).
<?php echo date('jS F Y - g:ia', strtotime($row['Date'])); ?>
Retrieving MySQL timestamp value and displaying as localtime
Moderator: General Moderators
-
energylevel
- Forum Newbie
- Posts: 4
- Joined: Mon Nov 08, 2004 5:11 am
Re: Retrieving MySQL timestamp value and displaying as local
MySQL handles the timezone conversion for TIMESTAMPs for you, but of course you have to set the right timezone for that to work properly.