/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getNumeroDeNits(){ var d1 = $('#datepicker1').val().split("-"); var dat1 = new Date(d1[2], parseFloat(d1[1])-1, parseFloat(d1[0])); var d2 = $('#datepicker2').val().split("-"); var dat2 = new Date(d2[2], parseFloat(d2[1])-1, parseFloat(d2[0])); var fin = dat2.getTime() - dat1.getTime(); var dias = Math.floor(fin / (1000 * 60 * 60 * 24)) return dias; }
URL: http://blog.oridoki.com/2009/10/08/javascript-diferencia-entre-dos-fechas/