There\'s a lot of info on doing time zone adjustments in PHP, but I haven\'t found an answer for specifically what I want to do due to all the noise.
Given a time in
As GZipp commented, his code is really only for PHP >= 5.3.0. That is fine, but - here's a version that will work in PHP >= 5.2.0. (Incidentally, it also works in 5.3+, and with 2 less function calls)
setTimezone(new DateTimezone($tz_to));
return $dt->format($format);
}
$time_diffs = array('now', '-1 hour', '-1 day', '-1 week', '-1 month', '+1 hour', '+1 week', '+1 month');
foreach ($time_diffs as $diff)
{
echo "{$diff}:"
. "\n\t"
. "Current: " . date("Y-m-d H:i:s", strtotime($diff))
. "\n\t"
. "UTC: " . time_translate("US/Eastern", "UTC", $diff)
. "\n\n";
}