Jump to content

is there any function that calculate hours?


Nati323

Recommended Posts

You can create two Javascript Date() objects for the start time and end time, then subtract the start timestamp from the end timestamp. The result will be a number in milliseconds. Divide by 1000 to get seconds and then by 3600 to get the number of hours. You can use the modulo operator and Math.floor() to get a combination of hours, minutes and seconds.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...