Iam trying to check whether the input date value from date picker is greater than the current time. Iam getting the date value in date/month/year format.
I want to check whether the input date is greater than current date. But can't get the time stamp from date/mpnth/year format.
function parseDate(input) {
if(input!=false){
var parts = input.match(/(\d+)/g);
var q=Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
return q;
}
}
if(new Date().getTime()<Date.parse(parseDate($("#sdate").val()))){
$("#err_startdate").html("Start date must be leass then current time");
}
You can use a date string to initialize a new Date object:
var d = new Date('12/10/2011');
d.getTime(); // 1323428400000
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.