Apr 16, 2004 #1 martinb7 Programmer Joined Jan 5, 2003 Messages 235 Location GB hi, i have this problem with a date. to get the current month i can use date("F"); but how can i get the month before or last month? any ideas?? Martin Computing help and info: http://www.webrevolt.biz
hi, i have this problem with a date. to get the current month i can use date("F"); but how can i get the month before or last month? any ideas?? Martin Computing help and info: http://www.webrevolt.biz
Apr 17, 2004 #2 Moonspell Programmer Joined Apr 1, 2004 Messages 83 Location GB easiest way i can think of (assuming you are working back from current date) is something like Code: $current_date = getdate(); $check_month = $current_date("mon") - $amount_to_subtract; $past_month = date("F",mktime(0,0,0,$check_month,$current_date("mday"), $current_date("year")); you can then alter this to do the same for days of the week/years etc. Upvote 0 Downvote
easiest way i can think of (assuming you are working back from current date) is something like Code: $current_date = getdate(); $check_month = $current_date("mon") - $amount_to_subtract; $past_month = date("F",mktime(0,0,0,$check_month,$current_date("mday"), $current_date("year")); you can then alter this to do the same for days of the week/years etc.