datetime - How to find start and end date of last 4 months including current in php -
datetime - How to find start and end date of last 4 months including current in php -
i want start , end dates on lastly 4 months including current month.please help.
regards jos
i'd way...
<?php // current day start $start = mktime(0,0,0,date('m'), date('d'), date('y'));; // loop through current , lastly 4 month ($i = 0; $i <=4; $i++) { // calculate first day of month $first = mktime(0,0,0,date('m',$start) - $i,1,date('y',$start)); // calculate lastly day of month $last = mktime(0, 0, 0, date('m') -$i + 1, 0, date('y',$start)); // output... echo date('y-m-d',$first) . " - ".date('y-m-d',$last). "<br>"; } ?>
php datetime
Comments
Post a Comment