Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JS time difference in minutes

var today = new Date();
var Christmas = new Date("2012-12-25");
var diffMs = (Christmas - today); // milliseconds between now & Christmas
var diffDays = Math.floor(diffMs / 86400000); // days
var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours
var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes
alert(diffDays + " days, " + diffHrs + " hours, " + diffMins + " minutes until Christmas 2009 =)");
 Run code snippet
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JS #time #difference #minutes
ADD COMMENT
Topic
Name
5+6 =