UTC Conversion to User Timezone with Daylight Savings Time

635 Views Asked by At

OK I got my mySql timezone package installed from http://dev.mysql.com/downloads/timezones.html

I'm also storing all my times with UTC_TIMESTAMP();

And my little tidbit of code:

$_SESSION['user_tz'] = 'America/New_York';
$last = "CONVERT_TZ(p.posted_on, 'UTC', '{$_SESSION['user_tz']}')";

I get back UTC/GMT -5 hours which is an hour ahead because of daylight savings time (DST)

I've been checking searching stack overflow and google for a few hours now, still not quite sure how to work around this. I'm really confused as to how to work around this? Help is greatly appreciated.

1

There are 1 best solutions below

1
On

write

 date_default_timezone_set('America/New_York'); 

Reference