Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery calculate datetime difference

 // will return number of days
function calculateDT() {
            var oneD = 1000 * 60 * 60 * 24;
            var startDT = ($("#ETDsdt").val());
            var endDT = ($("#ETDedt").val());
            var sMS = new Date(startDT);
            var eMS = new Date(endDT);
            return Math.round((eMS.getTime() - sMS.getTime()) / oneD);
        }
 
PREVIOUS NEXT
Tagged: #jquery #calculate #datetime #difference
ADD COMMENT
Topic
Name
3+2 =