To a specified date, month date, and date of the week.

Source: Internet
Author: User



To the specified date, Month day, get the start date of the week (example: 2016.6.15  get 2016.6.13-2016.6.19) public
	function   Get_oneweek ($one _date) {
		//$first =1 indicates that the starting date of Monday per week is 0 for each Sunday as the start date
		$first =1;
		Gets the day ordinal of the current week Sunday is 0 weeks a to Saturday is 1-6
		$w =date (' W ', Strtotime ($one _date));
		Gets the start date of the week, if $w is 0, then represents Sunday, minus 6 days
		$week _start=date (' y-m-d ', Strtotime ("$one _date-". $w? $w-$first: 6). ' Days ');
		echo $week _start;
		This week's end date
		$week _end=date (' y-m-d ', Strtotime ("$week _start +6 Days"));
		echo $week _end;

		$One _week = Array ($week _start, $week _end);
		return $One _week;
	}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.