0

I'm trying to add months to a date using the following function

 date('Y-m-d', strtotime("+238 months", strtotime("2018-02-25"))) // gives the correct date as 2037-12-25

The function works when the I'm trying to add less than 238 months. When I tried to add a bigger number it gives the wrong answer as 1969-12-31.

 date('Y-m-d', strtotime("+239 months", strtotime("2018-02-25"))) // gives the wrong date as 1969-12-31.

If this is not the correct way to do, please suggest a function that works for the bigger months. Thank you.

Julia
  • 1,207
  • 4
  • 29
  • 47

0 Answers0