Created
March 25, 2012 00:54
-
-
Save stefanocudini/2190479 to your computer and use it in GitHub Desktop.
convert time from utc to locale timezone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//convert time from utc to locale timezone | |
$tz = getenv('TZ'); // Get current server time zone setting | |
echo "Current timezone setting: $tz <br>"; | |
putenv("TZ=EST5EDT"); // Change to US Eastern time zone or whatever you want | |
$lt = localtime(time(), TRUE); | |
echo "EST local time: ".$lt['tm_hour'].':'.$lt['tm_min'].':'.$lt['tm_sec']." <br>"; | |
putenv("TZ=$tz"); // Change it back to the original server time zone | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment