Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function set_timezone() {
- $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
- $current_offset = get_option('gmt_offset');
- $tzstring = get_option('timezone_string');
- $check_zone_info = true;
- if (false !== strpos($tzstring,'Etc/GMT')) { $tzstring = ''; }
- if (empty($tzstring)) {
- $check_zone_info = false;
- if (0 == $current_offset) {
- $tzstring = 'UTC+0';
- } elseif ($current_offset < 0) {
- $tzstring = 'UTC' . $current_offset;
- } else {
- $tzstring = 'UTC+' . $current_offset;
- }
- }
- @putenv("TZ=" . $tzstring);
- @ini_set('date.timezone', $tzstring);
- if (function_exists('date_default_timezone_set')) {
- @date_default_timezone_set($tzstring);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement