Do you want to add six calendar months, or 180 days?
To add six calendar months (2003-09-15 plus 6 months would be 2004-03-15), I'd split the date at the dashes, add 6 to the month value, and if that value is more than 12, subtract 12 from it and add 1 to the year.
To add 180 days, I'd use strtotime() to convert the date string to a Unix time tick, then add 60 seconds/minute * 60 minutes/hour * 24 hours/day * 180 days to the tick number, then use date() to convert it back to a date string.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.