-2

I want to add 30 days to current date time.

for example :

$today = date("Y-m-d H:i:s");

I want to generate new date time , I want to add 30 days to $today date time.

How I do that?

UPDATE:

special for those 5 supernova smart guys: John Conde, Woot4Moo, cryptic ツ, moonwave99, Marc B ; yes it is duplicate but people formulate their question differently and this post may help other people to find faster than other post which was formulated differently but have same main idea. I would not mark this as trash, people do think different and use different key words during searching, and somebody may find this post quicker than the other duplicate post... have fun!

Jigberto
  • 1,513
  • 7
  • 27
  • 50

3 Answers3

7
$thirty_days_ahead =  date('Y-m-d H:i:s', strtotime("+30 days") )
karthikr
  • 97,368
  • 26
  • 197
  • 188
3

try this

$today = date('Y-m-d H:i:s',strtotime("+30 days"));
Fabio
  • 23,183
  • 12
  • 55
  • 64
1
strtotime("+30 days")

should be the most simple way to do it.

Woot4Moo
  • 23,987
  • 16
  • 94
  • 151