略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: timezone_abbreviations_list

2024-12-22

timezone_abbreviations_list

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

timezone_abbreviations_list别名 DateTimeZone::listAbbreviations()

说明

此函数是该函数的别名: DateTimeZone::listAbbreviations()

add a noteadd a note

User Contributed Notes 3 notes

up
30
dustinalan
12 years ago
This was driving me nuts so I'm adding a note here.

Took a while to get the simple time zone abbreviation for a given time zone. If you have the name just do this:

<?php
$dateTime
= new DateTime();
$dateTime->setTimeZone(new DateTimeZone('America/Los_Angeles'));
return
$dateTime->format('T');
?>

Will return PST

[red.: Or PDT is the current date/time is during Daylight Savings Time]
up
2
Chris Danielson
13 years ago
The mention of using 'US/Pacific-New' is actually a deprecated process.

See here:  http://us.php.net/manual/en/timezones.others.php

Where it is described:

Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.
up
0
drizzt321 at gmail dot com
13 years ago
If anyone is confused about the US/Pacific-New that appears in the list, apparently it has something to do with a bill that was that was passed by the House in 1989, but never signed into law. It has to do with delaying the switchover until after the election. Read more about it at http://catless.ncl.ac.uk/Risks/13.87.html and it should be the first posting. Or just do a search for US/Pacific-New.

官方地址:https://www.php.net/manual/en/function.timezone-abbreviations-list.php

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