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

星期的计算函数

WBOY
WBOYOriginal
2016-06-21 09:12:11920browse

函数

/**
* 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
Previous article:五 分页类Next article:看看文档吧...