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

指定时间是否为夏日制

WBOY
Release: 2016-06-13 12:33:39
Original
1122 people have browsed it

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

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

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


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

}

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template