wp_timezone_string
函数
wp_timezone_string ( No parameters )
- 返回值
-
- (string) PHP timezone name or a ±HH:MM offset.
- 定义位置
-
-
wp-includes/functions.php
, line 118
-
wp-includes/functions.php
- 引入
- 5.3.0
- 弃用
- –
Retrieves the timezone of the site as a string.
Uses the `timezone_string` option to get a proper timezone name if available,
otherwise falls back to a manual UTC ± offset.
Example return values:
– ‘Europe/Rome’
– ‘America/North_Dakota/New_Salem’
– ‘UTC’
– ‘-06:30’
– ‘+00:00’
– ‘+08:45’
function wp_timezone_string() {
$timezone_string = get_option( 'timezone_string' );
if ( $timezone_string ) {
return $timezone_string;
}
$offset = (float) get_option( 'gmt_offset' );
$hours = (int) $offset;
$minutes = ( $offset - $hours );
$sign = ( $offset
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。