Javascript examples for Date Operation:Date Compare
Get Difference between 2 dates
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w .j av a 2s . co m*/ var date1 = new Date("09/07/2013"); var date2 = new Date("09/15/2015"); var timeDiff = Math.abs(date2.getTime() - date1.getTime()); var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); console.log(diffDays); } </script> </head> <body> </body> </html>