I’m making a query on a database using the timestamp. Right now i’m using hardcoded dates for the query,
$dd1 = 20;//date("d",$ddb1);
$mm1 = date("m");
$yyyy1 = date("Y");
$dd2 = 26;//date("d",$ddb2);
$mm2 = date("m");
$yyyy2 = date("Y");
But i need the code to calculate last weeks data (Monday to Sunday), whenever i run the scrip. For example, i run the scrip today (Wensday) so the calculated time should be last week from (Monday to Sunday). The same result should be in any other days of this week untill 12:00:01 Sunday night.
Tried to do something like:
//$ddb1 = time() - ($argv[1] * 24 * 60 * 60);
//$ddb2 = time() - ($argv[2] * 24 * 60 * 60);
To substract a number of days from the current date, but there must be a automatic way to do this.
1 Answer