I use this code to generate yesterday at PST (aka America / Los_Angeles) time. I cannot figure out how to convert the result to UTC.
date_default_timezone_set("America/Los_Angeles"); $time1 = date("Ymd H:i:s", mktime(0,0,0, date('n'), date('j')-1, date('Y')));
I tried this, but $ time1 is not datetime, this is a string. Therefore, the following will not work.
$time1->setTimezone(new DateTimeZone("UTC"));
source share