php - Determining percentages and past seven days -
i coming here simple (i think) question today. figure out past 7 days php
so: have todays date in variables (like $day = 2, $month = 5, $year = 2013
, put 2/5/2013), question how go getting past 7 days (in same format) such in case
2/5/2013 1/5/2013 30/4/2013 29/4/2013 28/4/2013 27/4/2013 26/4/2013
i have tried subtracting days each variable (like $day6 = $todays_date - 1;
) getting month , year changes quite difficult believe.
any answers appreciated.
you use mktime, , subtract number of seconds each day:
$today = mktime(0,0,0,$month,$day,$year); for($i=0;$i<=6;$i++){ echo date('j/n/y',$today-($i*(24*60*60))) . '<br />; }
Comments
Post a Comment