PHP timezone_offset_get() 函数

PHP 教程 · 2019-01-24 11:13:06

实例

返回相对于 GMT 的时区偏移:

<?php
$tz=timezone_open("Asia/Taipei");
$dateTimeOslo=date_create("now",timezone_open("Europe/Oslo"));
echo timezone_offset_get($tz,$dateTimeOslo);
?>

定义和用法

timezone_offset_get() 返回相对于 GMT 的时区偏移。

语法

timezone_offset_get(object,datetime);

参数 描述
object 必需。规定一个由 timezone_open() 返回的 DateTimeZone 对象。
datetime 必需。规定需要计算偏移的日期/时间。

技术细节

返回值: 成功则返回以秒为单位的时区偏移,失败则返回 FALSE。
PHP 版本: 5.2+

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Masterminds of Programming

Masterminds of Programming

Federico Biancuzzi、Chromatic / O'Reilly Media / 2009-03-27 / USD 39.99

Description Masterminds of Programming features exclusive interviews with the creators of several historic and highly influential programming languages. Think along with Adin D. Falkoff (APL), Jame......一起来看看 《Masterminds of Programming》 这本书的介绍吧!

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具