Using a Time Zone Conversion When Dynamically Generating Results

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-21T21:00:44Z Indexed on 2010/04/21 21:03 UTC
Read the original article Hit count: 257

Filed under:

Hello,

If I understand correctly, the code below converts $row["datesubmitted"] from one timezone to another.

I would like to print the converted $row["datesubmitted"] dynamically in an HTML table. Is there a way that I can apply the conversion below for each row that is pulled from MySQL? I assume that I can't just plug $row["dt"] into the code since there is no field called "dt" in the MySQL that I am using.

Thanks in advance,

John

$dt = new DateTime($row["datesubmitted"], $tzFrom); 
$dt->setTimezone($tzTo); 

© Stack Overflow or respective owner

Related posts about php