Using a Php date functions i would like to get the last week date ranges,
for example.
its Friday, 24th June 2016 Today.
I want the out put
Last week Start Date : 2016-06-13 (YYYY-mm-dd Format)
Last week End Date : 2016-06-19 (YYYY-mm-dd Format)
Is that possible ?
<?php
echo date("Y-m-d", strtotime("last week monday"));
echo "<br>";
echo date("Y-m-d", strtotime("last sunday"));
?>
Just use strtotime function:
echo date("Y-m-d",strtotime('sunday',strtotime('last week'))); //2016-06-19
echo date("Y-m-d",strtotime('monday',strtotime('last week'))); //2016-06-13
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With