Created
September 25, 2013 03:20
-
-
Save flowerains/6694812 to your computer and use it in GitHub Desktop.
判断一个美国时间是否为夏令时,非常好用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//判断美国那个时间段是否为夏令时 | |
function is_dst($timestamp) | |
{ | |
$timezone = date('e'); //获取当前使用的时区 | |
date_default_timezone_set('US/Pacific-New'); //强制设置时区 | |
$dst = date('I',$timestamp); //判断是否夏令时 | |
date_default_timezone_set($timezone); //还原时区 | |
return $dst; //返回结果 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment