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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -