Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add 1 month to a DateTime variable?

I have a Subscription model. In my subscriptions table I have a DateTime column called expires_at.

For example:

expires_at: "2013-07-03 08:00:26"

I need to add 30 days more. Which method do I need to use for this?

like image 700
Stefan Hansch Avatar asked Dec 15 '22 07:12

Stefan Hansch


1 Answers

Try this:

=> object.expires_at + 1.month
=> Sat, 03 Aug 2013 08:00:26 +0000
like image 64
Philidor Avatar answered Dec 31 '22 05:12

Philidor