wp_timezone_override_offset()
gmt_offset modification for smart timezone handling.
Description
Overrides the gmt_offset option if we have a timezone_string available.
Return
(float|false) Timezone GMT offset, false otherwise.
Source
File: wp-includes/functions.php
function wp_timezone_override_offset() { $timezone_string = get_option( 'timezone_string' ); if ( ! $timezone_string ) { return false; } $timezone_object = timezone_open( $timezone_string ); $datetime_object = date_create(); if ( false === $timezone_object || false === $datetime_object ) { return false; } return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 ); }
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_timezone_override_offset