Jump to content


Photo

Adding 1 month to date


  • Please log in to reply
1 reply to this topic

#1 jon_17

jon_17
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 20 September 2006 - 03:37 AM

Hi all,

I want to add 1 month to the current date and echo the result in this format: YYYYmmdd

How do I do that and still maintain the validity of the date (i.e if current date is 2006 12 25, then adding 1 month will give me 2007 01 25 not 2006 13 25)

Thank you,

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 20 September 2006 - 03:47 AM

Almost straight from the manual.

$nextmnth  = date("Y m d", mktime(0, 0, 0, date("m")+1  , date("d"), date("Y")));





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users