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
Post a Comment