Home > php教程 > php手册 > 星期的计算函数

星期的计算函数

WBOY
Release: 2016-06-21 09:12:11
Original
909 people have browsed it

函数

/**
* getDay 返回星期(星期天=0)
* @param
*  $y 年
*  $m 月
*  $d 日
* 假定传入的日期合法
* 计算范围:1752-9-14以后
*/
function getDay($y,$m,$d) {
  if($m==1 || $m==2) {
    $m += 12;
    $y--;
  }
  $t = $d+2*$m+bcdiv(3*($m+1),5,0)+$y+bcdiv($y,4,0)-bcdiv($y,100,0)+bcdiv($y,400,0);
  return ($a+1)%7;
}
?>



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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template