在Javascript中如何使用三个日期检查当前日期时间。如果日期是以前的datetime.i需要根据当前日期时间验证日期,我想禁用单选按钮 假设a)10/2/2017 11:00 b)21/3/2018 11:20 c)28/4/2018 14:00 以上三个日期我需要阻止单选按钮并在javascript中扼杀日期
function formatAMPM(date) { // This is to display 12 hour format like
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
return strTime;
}
var myDate = new Date();
var displayDate = myDate.getMonth()+ '/' +myDate.getDate()+ '/' +myDate.getFullYear()+ ' ' +formatAMPM(myDate);
alert(displayDate);
var dt = Date.parse(displayDate);
var d = Date.parse(ts);
var d1 = Date.parse(ts1);
var d2 = Date.parse(ts2);
alert(d);
alert(dt);