PHP CODE
$t = strtotime( '2012-09-21T03:00:00+00:00 America/Chicago' );
$t2 = date('c',$t);
echo $t2;
OUPUT
2012-09-20T23:00:00-04:00
QUESTION
Chicago's timezone is UTC-5, why don't I get 2012-09-20T22:00:00-05:00
as the result?
$t = strtotime( '2012-09-21T03:00:00+00:00 America/Chicago' );
$t2 = date('c',$t);
echo $t2;
2012-09-20T23:00:00-04:00
Chicago's timezone is UTC-5, why don't I get 2012-09-20T22:00:00-05:00
as the result?
strtotime
converts to a Unix timestamp. date
will convert the timestamp to a string using the current time zone. Try setting your time zone first.
$t = strtotime( '2012-09-21T03:00:00+00:00 America/Chicago' );
date_default_timezone_set('America/Chicago');
$t2 = date('c',$t);
echo $t2;