Title: WP_Customize_Date_Time_Control::get_timezone_info
Published: November 20, 2017
Last modified: February 24, 2026

---

# WP_Customize_Date_Time_Control::get_timezone_info(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#wp--skip-link--target)

Get timezone info.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#return)󠁿

 array Timezone info. All properties are optional.

 * `abbr` string
 * Timezone abbreviation. Examples: PST or CEST.
 * `description` string
 * Human-readable timezone description as HTML.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#source)󠁿

    ```php
    public function get_timezone_info() {
    	$tz_string     = get_option( 'timezone_string' );
    	$timezone_info = array();

    	if ( $tz_string ) {
    		try {
    			$tz = new DateTimeZone( $tz_string );
    		} catch ( Exception $e ) {
    			$tz = '';
    		}

    		if ( $tz ) {
    			$now                   = new DateTime( 'now', $tz );
    			$formatted_gmt_offset  = $this->format_gmt_offset( $tz->getOffset( $now ) / HOUR_IN_SECONDS );
    			$tz_name               = str_replace( '_', ' ', $tz->getName() );
    			$timezone_info['abbr'] = $now->format( 'T' );

    			$timezone_info['description'] = sprintf(
    				/* translators: 1: Timezone name, 2: Timezone abbreviation, 3: UTC abbreviation and offset, 4: UTC offset. */
    				__( 'Your timezone is set to %1$s (%2$s), currently %3$s (Coordinated Universal Time %4$s).' ),
    				$tz_name,
    				'<abbr>' . $timezone_info['abbr'] . '</abbr>',
    				'<abbr>UTC</abbr>' . $formatted_gmt_offset,
    				$formatted_gmt_offset
    			);
    		} else {
    			$timezone_info['description'] = '';
    		}
    	} else {
    		$formatted_gmt_offset = $this->format_gmt_offset( (int) get_option( 'gmt_offset', 0 ) );

    		$timezone_info['description'] = sprintf(
    			/* translators: 1: UTC abbreviation and offset, 2: UTC offset. */
    			__( 'Your timezone is set to %1$s (Coordinated Universal Time %2$s).' ),
    			'<abbr>UTC</abbr>' . $formatted_gmt_offset,
    			$formatted_gmt_offset
    		);
    	}

    	return $timezone_info;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/customize/class-wp-customize-date-time-control.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/customize/class-wp-customize-date-time-control.php#L254)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/customize/class-wp-customize-date-time-control.php#L254-L294)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Customize_Date_Time_Control::format_gmt_offset()](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/)`wp-includes/customize/class-wp-customize-date-time-control.php` |

Format GMT Offset.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#)

| Used by | Description | 
| [WP_Customize_Date_Time_Control::content_template()](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/content_template/)`wp-includes/customize/class-wp-customize-date-time-control.php` |

Renders a JS template for the content of date time control.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_date_time_control%2Fget_timezone_info%2F)
before being able to contribute a note or feedback.