I'm trying to deal with taking the current date and getting the beginning day/date of the week (Monday being day 1). Then using the calendar date of the 1st day of the week, I'm adding 6 to get the last day of the week. My issue is dealing with year boundaries, as in this week's range is 12/30/2013 - 1/5/2014. That's the issue...when the week has a year change in the middle. I'm not wanting to use week numbers to get week range as I don't want to deal with week 53.
So, I've come up with the below code, but something's missing and I'm hoping someone can help me by spotting the obvious.
Thanks so much =)
$day1 = DateTime::createFromFormat('Y-m-d', $curdate);
$day1->setISODate((int)$day->format('O'), (int)$day1->format('W'), 1);
return "1st Day: ".$day1->format('Y-m-d');