wp_timezone()WP 5.3.0

Gets the site's timezone as a DateTimeZone object.

The returned timezone object can be created based on the timezone label Asia/Tashkent or a specified offset ±HH:MM, for example +02:00.

Used By: wp_date()
1 time — 0.0023901 sec (very slow) | 50000 times — 2.04 sec (fast)

No Hooks.

Returns

DateTimeZone. PHP Timezone object.

Usage

wp_timezone();

Examples

1

#1 Demo

$timezone = wp_timezone();

echo $timezone->getName(); // Asia/Tashkent

Changelog

Since 5.3.0 Introduced.

wp_timezone() code WP 6.9

function wp_timezone() {
	return new DateTimeZone( wp_timezone_string() );
}