I\'m just looking for a little clarification on this. PHP 5.4 eliminated the TZ environmental variable and the \"guessing\" that date_default_timezone_get used
On a Windows server, it is possible to get the local system time zone with a little bit of math:
diff($nowSys);
echo $nowUTC->format('H:i:s') . '
';
echo $nowSys->format('H:i:s') . '
';
echo $offset->format('%H');
?>
From my locale (UTC-05) at the time of writing the output of this code is:
22:16:41
17:16:41
05
There is one caveat: the timestamps can sometimes be off by 1 second, causing the $offset variable to have 4:59:59. Getting the correct timezone consistently should do a little bit of rounding to be safe.