Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date question

Status
Not open for further replies.

martinb7

Programmer
Jan 5, 2003
235
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:

 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top