I searched for a solution to this problem but found most of them fairly complex/hard for a newbie to understand so I came up with this...perhaps it will be of use to someone.
I have an online calendar/itinerary app that defaults to the current date for the beginning of the list of items shown.
I wanted to give the users a couple of simple buttons to take them back to items from the beginning of the current week, current month, etc. (ie. no need to deal with a date dropdown or date selector), So a hidden date value I wanted to pass in the submit button was the date of the most recent past Monday. Here's what I came up with to find that value.
$nowstring=date('Y-m-d');
$wkcounter=0;
$days=array();
do{
$daytemp=date('D', strtotime("$nowstring -$wkcounter day"));
$datetemp=date('Y-m-d', strtotime("$nowstring -$wkcounter day"));
$days[$daytemp]=$datetemp;
//echo "$wkcounter $daytemp $datetemp<br>"; //debug
$wkcounter++;
} while($wkcounter < 7);
$thismonday=$days['Mon']; // Could change value to any day you are looking for
echo "<br>MOST RECENT MONDAY: $thismonday<br>";
All I have to do is pass the value "$thismonday" in the form and the calendar item selector uses it as the value for the data query.
Now I want to modify this so that it also gives me the date for the prior week, that should not be too hard.