datetime - how will i take future months by the given month and year in php -


 insert:<input type="text" name="my">     no of months:<input type="text" name="noofmonths"> <input type="submit" name="sub" value="submit"> 

ater clicking submitting button want corresponding future month/year.

eg:insert: septemeber 2015; no of months:4;  want o/p:january 2016; 

another eg:

eg:insert: december 2015; no of months:2;  want o/p:february 2016; 

you can try code

suppose user enter date

$date = "20 september";  //your spelling september wrong make sure user enter correct spelling 

user enter 4 in months

echo $effectivedate = date('f y', strtotime("+4 months", strtotime($date))); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -