date after n months in php

get the date on giving the start date and the months .

Page 1 of 1

3 Replies - 1557 Views - Last Post: 03 February 2010 - 06:36 AM Rate Topic: -----

#1 devarajesh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-February 10

date after n months in php

Posted 02 February 2010 - 10:08 PM

Hi,
I need to calculate the end date on giving the start date and the number of months to be calculated
to get the end date.
Please any one having idea about this help me.

Regards
Raj
Is This A Good Question/Topic? 0
  • +

Replies To: date after n months in php

#2 Auzzie  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 43
  • View blog
  • Posts: 573
  • Joined: 20-January 09

Re: date after n months in php

Posted 03 February 2010 - 01:40 AM

What have you already done to try and solve this problem yourself?



[rules][/rules]
Was This Post Helpful? 1
  • +
  • -

#3 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: date after n months in php

Posted 03 February 2010 - 04:01 AM

google the 'date' function or mktime() and it will all be there on php.net
Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2984
  • Posts: 10,316
  • Joined: 08-August 08

Re: date after n months in php

Posted 03 February 2010 - 06:36 AM

This should be close:
Get the current month number and add n modulus 12 months to it. Next add the integer of one plus n plus the current month number divided by 12 to the current year and use the current day of the month. If you have trouble doing this in code, post what you've tried and perhaps we can help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1