H i , A traditional method would look something like this.
Starting with the date value in the dot notation format we can convert to the dd/mm/yyyy format.
UPDATE as comment, given that the date string needs reordering into MM/DD/YYYY
var inputval = "09.02.2014".split(".");
var dateval = new Date(inputval[1]+"/"+inputval[0]+"/"+inputval[2]);
/* with our Date object we can now compare */
var currDate = new Date();
var diffDays = Math.round(Math.abs((dateval.getTime() - currDate.getTime())/(24*60*60*1000)));
The var diffdays =
quick date compare snippet taken from :
How to calculate the number of days between two dates using JavaScript?
Worth to mention about adding all this into a function for re-usability.
function daysDifferenceFromToday(datestr) {
var inputval = datestr.split(".");
var dateval = new Date(inputval[1]+"/"+inputval[0]+"/"+inputval[2]);
var currDate = new Date();
return Math.round(Math.abs((dateval.getTime() - currDate.getTime())/(24*60*60*1000)));
}
/* usages */
alert(daysDifferenceFromToday("09.02.2014"));
if(daysDifferenceFromToday("05.02.2014")>2) {
...
}