Created
January 7, 2013 06:43
-
-
Save kyleweiner/4472995 to your computer and use it in GitHub Desktop.
PHP: A snippet for setting the default timezone using a GMT offset.
This file contains hidden or 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
// Set the default timezone using a GMT offset | |
$offset = -5; // GMT offset | |
$is_DST = FALSE; // observing daylight savings? | |
$timezone_name = timezone_name_from_abbr('', $offset * 3600, $is_DST); // e.g. "America/New_York" | |
date_default_timezone_set($timezone_name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment