略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: date_offset_get

2024-05-04

date_offset_get

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

date_offset_get别名 DateTime::getOffset()

说明

此函数是该函数的别名: DateTime::getOffset()

add a noteadd a note

User Contributed Notes 1 note

up
0
Kae Cyphet
11 years ago
The following gets the timezone of the server including daylight savings time changes.

<?php
$seconds
= date_offset_get(new DateTime);
print
$seconds / 3600;
// returns pos/neg decimal (eg. -7 if in PST and DST is active.)
// remember there are time zones with 30 and 45 min offsets
// http://en.wikipedia.org/wiki/Time_zone
?>

官方地址:https://www.php.net/manual/en/function.date-offset-get.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3