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://www.codercto.com/courses/l/5.html

查看所有标签

New Dark Age

New Dark Age

James Bridle / Verso Books / 2018-7-17 / GBP 16.99

As the world around us increases in technological complexity, our understanding of it diminishes. Underlying this trend is a single idea: the belief that our existence is understandable through comput......一起来看看 《New Dark Age》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

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

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具