Home  >  Article  >  Backend Development  >  指定时间是否为夏日制

指定时间是否为夏日制

WBOY
WBOYOriginal
2016-06-13 11:39:32994browse

指定时间是否为夏令制
如何判断指定时间来获取是否采用美国夏令制

我知道可以写一个函数来判断当前是否为美国夏令制...

但是找咯一下没有说指定时间来判断....


//夏令制判断
function is_dst(){
  $timezone=date('e');  //获取当前使用的时区
  date_default_timezone_set('US/Pacific-New'); //强制设置时区
  $dst=date('I');  //判断是否夏令时
  date_default_timezone_set($timezone);  //还原时区
  return $dst;  //返回结果

}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn