I use strtotime just fine to find the records of last week and next week in my database, but I can not find how to find the previous six days if the user selects the past date.
Here is how I know that today and the previous six days:
$today = date("Y-m-d");
$minus6 = date('Y-m-d', strtotime('-6 days'));
Now, how can I switch $ today with $ dateString, as provided by my users input? I thought this was similar to my google searches, but it did not produce any results:
$dateString = 2010-01-25; // for example
$minus6 = date('Y-m-d', strtotime('-6 days, $dateString');
Is there any fundamental information about dates, strtotime, or what? Thanks for any help.
Bryan source
share