-
-
Save gmatta01/a8a0495ca89dd639a91e404d1de71c70 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