I generally use strtotime() as the swiss army knife of PHP date handling. You give it a string and a timestamp to use as a base, and it gives you back a new timestamp. So you can say: strtotime("+6 months", $sometimestamp); And it will give you back the time stamp six months after $sometimestamp, taking into account leap years, changes of year, I think daylight savings (although I'm not certain of that), etc. Really, if you want to do any sort of time math that's not second-based, strtotime() will take most of the hard work off your hands. It's simply amazing. On Sunday 17 June 2007, Keith Spiller wrote: > Hi, > > RE: Previous and Next Month and Year > > This is my code: > > $next_month = date('F Y', time()+$month); > $prev_month = date('F Y', time()-$month); > > echo "$prev_month <br /> \n"; #Result "June 2007" > echo "$next_month <br /> \n"; #Result "June 2007" > > What I am trying to do is get the month and year > based upon a + or - $month value. > > The variable $month being "6" for the month of June of > the present year of 2007. > > For example ($month -7) would be December 2006, > and ($month +7) would be January 2006. > > Please help... Thank you. > > Keith -- Larry Garfield AIM: LOLG42 larry@xxxxxxxxxxxxxxxx ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php