php - calculate end date from duration -


i have duration drop down menu options 'yearly/quarterly/monthly' , start date textbox datepicker. there textbox end_date.

based on duration need end date when duration , start date selected.

e.g.: start date 23-09-2015 , duration chosen 3 months so, need display 23-12-2015.but have no idea how that.

try this. example. hope help.

<?php $date = date("y-m-d");  $date = strtotime(date("y-m-d", strtotime($date)) . " +3 month"); echo date("y-m-d",$date); ?> 

if need add months , date this

$date = strtotime(date("y-m-d", strtotime($date)) . " +3 month 2 day"); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -