复制代码 代码如下:
<?php
function getWeekDate($year,$weeknum){
$firstdayofyear=mktime(0,0,0,1,1,$year);
$firstweekday=date('N',$firstdayofyear);
$firstweenum=date('W',$firstdayofyear);
if($firstweenum==1){
$day=(1-($firstweekday-1))+7*($weeknum-1);
$startdate=date('Y-m-d',mktime(0,0,0,1,$day,$year));
$enddate=date('Y-m-d',mktime(0,0,0,1,$day+6,$year));
}else{
$day=(9-$firstweekday)+7*($weeknum-1);
$startdate=date('Y-m-d',mktime(0,0,0,1,$day,$year));
$enddate=date('Y-m-d',mktime(0,0,0,1,$day+6,$year));
}
return array($startdate,$enddate);
}
?>
您可能感兴趣的文章:
php number_format()保留小数点后几位
PHP小数点后保留几位的简单示例
php小数取整的方法(附实例)
php小数点后取两位的三种实现方法