Home > Backend Development > PHP Tutorial > Monday's date in today's date

Monday's date in today's date

WBOY
Release: 2016-07-25 08:48:50
Original
927 people have browsed it
当日日期中的星期一的日期
                   
                               
                                       
                                       
            
  1. private function mondayTime($timestamp=0, $is_return_timestamp=true){
  2.                 static $cache ;
  3.                 $id = $timestamp.$is_return_timestamp;
  4.                 if(!isset($cache[$id])){
  5.                         if(!$timestamp) $timestamp = time();
  6.                         $monday_date = date('Y-m-d', $timestamp-86400*date('w',$timestamp)+(date('w',$timestamp)>0?86400:-/*6*86400*/518400));
  7.                         if($is_return_timestamp){
  8.                                 $cache[$id] = strtotime($monday_date);
  9.                         }else{
  10.                                 $cache[$id] = $monday_date;
  11.                         }
  12.                 }
  13.                 return $cache[$id];
  14.         }
  15. echo $this->mondayTime(time() + 24*3600*2,false);exit;
复制代码


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