On this page
wp_timezone(): DateTimeZone
Retrieves the timezone of the site as a DateTimeZone object.
Description
Timezone can be based on a PHP timezone string or a ±HH:MM offset.
Return
DateTimeZone Timezone object.
Source
File: wp-includes/functions.php. View all references
function wp_timezone() {
return new DateTimeZone( wp_timezone_string() );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_timezone_string() wp-includes/functions.php | Retrieves the timezone of the site as a string. |
Used By
| Used By | Description |
|---|---|
| current_datetime() wp-includes/functions.php | Retrieves the current time as an object using the site’s timezone. |
| wp_date() wp-includes/functions.php | Retrieves the date, in localized format. |
| get_post_datetime() wp-includes/general-template.php | Retrieves post published or modified time as a |
| get_gmt_from_date() wp-includes/formatting.php | Given a date in the timezone of the site, returns that date in UTC. |
| get_date_from_gmt() wp-includes/formatting.php | Given a date in UTC or GMT timezone, returns that date in the timezone of the site. |
| iso8601_to_datetime() wp-includes/formatting.php | Given an ISO 8601 (Ymd\TH:i:sO) date, returns a MySQL DateTime (Y-m-d H:i:s) format used by post_date[_gmt]. |
| date_i18n() wp-includes/functions.php | Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds. |
| mysql2date() wp-includes/functions.php | Converts given MySQL date string into a different format. |
| current_time() wp-includes/functions.php | Retrieves the current time based on specified type. |
| WP_Date_Query::build_mysql_datetime() wp-includes/class-wp-date-query.php | Builds a MySQL format date/time based on some query parameters. |
Changelog
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_timezone