Tribe__Timezones::wp_timezone_string()

Returns the current site-wide timezone string.

Contents

Based on the core WP code found in wp-admin/options-general.php.


Return

(string)


Top ↑

Source

File: src/Tribe/Timezones.php

	public static function wp_timezone_string() {
		$current_offset = get_option( 'gmt_offset' );
		$tzstring       = get_option( 'timezone_string' );

		// Return the timezone string if already set
		if ( ! empty( $tzstring ) ) {
			return $tzstring;
		}

		// Otherwise return the UTC offset
		if ( 0 == $current_offset ) {
			return 'UTC+0';
		} elseif ( $current_offset < 0 ) {
			return 'UTC' . $current_offset;
		}

		return 'UTC+' . $current_offset;
	}