wp_timezone()WP 5.3.0

Retrieves the timezone from site settings as a DateTimeZone object.

Timezone can be based on a PHP timezone string or a ±HH:MM offset.

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

No Hooks.

Return

DateTimeZone. 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.5.3

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