I use
$date = date("Y-m-d");
and in sql i use between max is = date("Y-m-d") min is = 6 days back
Is there a function that gives from date back $limit?
I use
$date = date("Y-m-d");
and in sql i use between max is = date("Y-m-d") min is = 6 days back
Is there a function that gives from date back $limit?
In PHP, it could be done like this:
$date_first = date("Y-m-d"); //today's date or use some other date
$date_second = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date_first)) . " -6 day")); //date before 6 days
EDIT
Based on Dan Lee's suggestion(see the comment below):
$date_before = date("Y-m-d", strtotime("-6 day"));
strtotime('-6 days') is enough, but you would need to cover it with date()date() to display a formatted date, instead of the timestamp. What you are getting is the timestamp. So, just pass it to the date() function along with the date format "Y-m-d".