tags:

views:

23

answers:

1

How to convert this date

2010-05-25 04:55:01 CST (America/Chicago)

to PST (America/Los_Angeles) timezone?

+1  A: 

Something like that (change the output format to suit your needs):

<?php
       $dte = new DateTime('2010-05-25 04:55:01', 
                  new DateTimeZone('America/Chicago'));
       $dte->setTimeZone(new DateTimeZone('America/Los_Angeles'));
       echo $dte->format(DateTime::COOKIE);
?>

Outputs:

Tuesday, 25-May-10 02:55:01 PDT

RC
You can't give the timezone in the first argument of the DateTime constructor, otherwise the second argument gets ignored. I've removed the timezone abbreviation from the first argument and updated the output.
Artefacto
@Artefacto, I wasn't aware of that. Thanks
RC