Click here to Skip to main content
15,888,320 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i wnt to get difference between two time patterns using javascript

Time is in decimal type

I want difference between two time in time using javascript

Please suggest solution for it

Thanks in Advance

Regards

Amritha
Posted
Comments
Sandeep Mewara 5-May-11 2:37am    
Not clear.

What do you mean "two time pattern"?

1 solution

Use JavaScript Date objects. Create two of them with the date/times you want, then use valueOf() to get the raw numbers (millisecs since epoch). Subtract them, so you have a time difference in millisecs. Divide by 1000 gives interval in secs. Divide again by 60 gives minutes... and so on...
See here[^] for some how-tos.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900