Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  24] [ 2]  / answers: 1 / hits: 27507  / 14 Years ago, tue, february 22, 2011, 12:00:00

It's a little complicated to calculate delta time in js.
this is the pseudo-code,



var atime = 2010-12-05T08:03:22Z;
var btime = 2010-01-11T08:01:57Z

var delta_time = btime - atime;
delta_time ?


I want to know exact date time between two time inputs.
is there any easy way to find out delta time?


More From » date

 Answers
132
var atime = new Date(2010-12-05T08:03:22Z);
var btime = new Date(2010-01-11T08:01:57Z);

var delta_time = btime - atime;


The value of delta_time will be the difference between the two dates in milliseconds.



If you're only interested in the difference, and don't care to differentiate between which is the later date, you might want to do



var delta_time = Math.abs(btime - atime);

[#93639] Saturday, February 19, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
deannaalysonl

Total Points: 703
Total Questions: 101
Total Answers: 115

Location: Saint Helena
Member since Tue, Nov 3, 2020
4 Years ago
;