How to add month in current date using Php

This is useful when you are playing with date and time.This is very short solution for it.

Below example is showing how to add 1 month in current date.

Suppose current date is 2016-05-25 10:33:19 and new date should be 2016-06-25 10:33:19


$today = date("Y-m-d h:i:s");// current date
$datemonth = strtotime(date("Y-m-d h:i:s", strtotime($today)) . "+1 month"); 
$after_month = date('Y-m-d h:i:s', $datemonth);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s