Forum Moderators: coopster

Message Too Old, No Replies

PHP daylight savings question with working code

         

JAB Creations

2:57 pm on Sep 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I store all date/time stamps as GMT in the database. My question is if PHP automatically somehow applies DST in conjunction with date_default_timezone_set or will I have to program my code a bit further?

- John

<?php
date_default_timezone_set('America/New_York');

function user_date_mysql($date,$format) {return date ($format,strtotime($date.'GMT'));}

$date = '2010-09-17 22:53:10';
echo user_date_mysql($date,'l F jS, Y, h:iA');
?>

enigma1

6:03 pm on Sep 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe it depends on the runtime php configuration settings and php version but you should be able to setup the tz anywhere.

[php.net...]