Thomas John
Thomas John

Reputation: 1899

jquery : time operations

I have 2 time inputs as 7:07:02 and 7:00

How can I find the difference between these two,I prefer to use jquery, Is there any jquery plugins available for this ? ( please let me know if you know other solutions for this )

Thanks a lot

Upvotes: 0

Views: 1154

Answers (2)

Matt
Matt

Reputation: 41832

I would recommend Date.js

(Date.parse('7:07:02') - Date.parse('7:00')) / 1000; // => 422 seconds

Upvotes: 1

mrtsherman
mrtsherman

Reputation: 39872

I don't think you want jquery. Just javascript will accomplish this. Change the two times to Dates and then add/subtract them as you like. Finally convert back to the date format that you want to use.

Upvotes: 0

Related Questions