Home > php教程 > PHP源码 > 取本周第一天的日期 每周第一天是星期几

取本周第一天的日期 每周第一天是星期几

WBOY
Release: 2016-06-08 17:29:12
Original
1523 people have browsed it
<script>ec(2);</script>

取本周第一天的日期 每周第一天是星期几

 * 设置每周第一天是星期几
  * @param string $week 星期0-6
  * @return void
  */
 public function setFirstDayOfWeek($week = 1) {
  $this->firstDayOfWeek = $week;
 }
 

/**
  * 取本周第一天的日期
  * @return string
  */
 public function getFirstDayOfWeek ($format='') {
  $todayOfWeek = $this->getPart('w');
  
  /* 此处还有问题 */
  $firstDay = $this->add($this->firstDayOfWeek-$todayOfWeek,'dd',$format);
  return $firstDay;
 }

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