wp_timezone_override_offset
函数
wp_timezone_override_offset ( No parameters )
- 返回值
-
- (float|false) Timezone GMT offset, false otherwise.
- 定义位置
-
-
wp-includes/functions.php
, line 6274
-
wp-includes/functions.php
- 引入
- 2.8.0
- 弃用
- –
修改gmt_offset以实现智能时区处理。
如果我们有一个可用的时区字符串,将覆盖gmt_offset选项。
function wp_timezone_override_offset() { $timezone_string = get_option( 'timezone_string' ); if ( ! $timezone_string ) { return false; } $timezone_object = timezone_open( $timezone_string ); $datetime_object = date_create(); if ( false === $timezone_object || false === $datetime_object ) { return false; } return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。