时间:2021-07-01 10:21:17 帮助过:13人阅读
本文实例讲述了php获取本周星期一具体日期的方法。具体如下:
private function mondayTime($timestamp=0,$is_return_timestamp=true){
static $cache ;
$id = $timestamp.$is_return_timestamp;
if(!isset($cache[$id])){
if(!$timestamp) $timestamp = time();
$monday_date = date('Y-m-d',$timestamp-86400*date('w',$timestamp)+(date('w',$timestamp)>0?86400:-/*6*86400*/518400));
if($is_return_timestamp){
$cache[$id] = strtotime($monday_date);
}else{
$cache[$id] = $monday_date;
}
}
return $cache[$id];
}
echo $this->mondayTime(time() + 24*3600*2,false);
exit;总结:以上就是本篇文的全部内容,希望能对大家的学习有所帮助。
相关推荐:
PHP实现清除固定日期内没有访问的图片
php字符串及流程控制的方法
16个常见的php基本函数
以上就是php获取本周一的日期实现方法的详细内容,更多请关注Gxl网其它相关文章!