我有实现日历的代码:
$( function() {
var dateFormat = "mm/dd/yy",
from = $( "#fromdate" ).datepicker({
minDate:0,
changeMonth: true
}).on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#todate" ).datepicker({
defaultDate: "+1w",
changeMonth: true
}).on( "change", function() {
from.datepicker( "option", "minDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
});
我有#fromdate
和#todate
HTML元素。我希望#fromdate
选择当前日期(它会这样做),并#todate
添加10天(这不起作用),并在日历上显示。
答案 0 :(得分:-1)
试试这段代码
$date = strtotime($date);
$date = strtotime("+10 day", $date);
echo date('M d, Y', $date);