I have a DATE_DATETIME variable that I would like to add a week to. Is there a function that will add a week or a certain number of days to a given date and return the new DATE_DATETIME?

It seems a pain to deal with month/year boundaries and leap years give me a headache. I was thinking there must be a function that can add a week to a date to support the repeating date api but I can't seem to find anything. A pointer or suggested approach would be much appreciated.

Thanks in advance.

Comments

carlwohlforth’s picture

Status: Active » Closed (fixed)

I ended up writing my own function using date_days_in_month ($y, $m); As long at that one deals with leap years properly I'm good to go.