Button.Dock = Fill
需要将此值传递给php中的var dt = 6;
var dtyp = M;
以获取6个月后的日期strtotime
需要将当天日期添加6天,if dtyp = D
需要将当前日期添加6年。
if dtyp = Y
<?php echo date("d/m/Y", strtotime("+6 days"));?>
$.each(data.response.duration,function(a,b){
var dt = b.exp_dur;
var dtyp = b.exp_type;
$('.after_dat').val('<?php echo date("d/m/Y", strtotime("+.'dt'. days"));?>')
});
和dt
将从db动态获取。
答案 0 :(得分:0)
if(b.exp_type === 'D'){
$('.after_dat').val('');
var date = new Date();
futr = parseInt(b.exp_dur)
date.setDate(date.getDate() +futr);
var dateMsg = date.getDate()+'/'+ (date.getMonth()+1) +'/'+date.getFullYear();
// alert(dateMsg);
$('.after_dat').val(dateMsg);
}
if(b.exp_type === 'M'){
$('.after_dat').val('');
futr = parseInt(b.exp_dur)
var jan312009 = new Date();
var eightMonthsFromJan312009 = new Date(new Date(jan312009).setMonth(jan312009.getMonth()+futr));
var dateMsg = eightMonthsFromJan312009.getDate()+'/'+ (eightMonthsFromJan312009.getMonth()+1) +'/'+eightMonthsFromJan312009.getFullYear();
$('.after_dat').val(dateMsg);
}
if(b.exp_type === 'Y'){
$('.after_dat').val('');
futr = parseInt(b.exp_dur)
var jan312009 = new Date();
var eightMonthsFromJan312009 = new Date(new Date(jan312009).setFullYear(jan312009.getFullYear()+futr));
var dateMsg = eightMonthsFromJan312009.getDate()+'/'+ (eightMonthsFromJan312009.getMonth()+1) +'/'+eightMonthsFromJan312009.getFullYear();
$('.after_dat').val(dateMsg);
}