Home >Backend Development >PHP Tutorial >星期的计算函数_PHP

星期的计算函数_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 12:35:59817browse

/**
* 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;
}
?>

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