Home  >  Article  >  Backend Development  >  php get start date and end date of this week

php get start date and end date of this week

WBOY
WBOYOriginal
2016-08-08 09:28:411178browse
$sdefaultDate = date("Y-m-d");
$first=1;
$w=date('w',strtotime($sdefaultDate));
$week_start=date('Y-m-d',strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'));
$week_end=date('Y-m-d',strtotime("$week_start +6 days"));

The above introduces PHP to get the start date and end date of this week, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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