We would like to know how to compare date with todays date where date is in format dd-mm-yyyy.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
<!--from w ww. j av a 2 s .co m-->
var currentDate = Date.now();
var date2 = new Date(2011,10,10);
if (currentDate > date2.getTime()) {
document.writeln("The current date is greater than the second date!");
}else{
document.writeln("The second date is greater than the current date!");
}
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: