time difference function

E

Em

How can I write a function to calculate the difference
between two times on a form and then turn it into
decimals of an hour?

Example:

13:00 to 13:54 is 0.9 hrs ?
 
J

John Vinson

How can I write a function to calculate the difference
between two times on a form and then turn it into
decimals of an hour?

Example:

13:00 to 13:54 is 0.9 hrs ?

Use DateDiff() to calculate the difference in minutes, and divide by
60:

DateDiff("n", [starttime], [endtime]) / 60.

You can use the Round() function to round this quotient to one or two
decimal places if you wish.
 
E

Em

Thanks... can you give an example of how to round the
result of the first function? I'm not sure how it's
supposed to look. (Need 1 decimal place)

-----Original Message-----
How can I write a function to calculate the difference
between two times on a form and then turn it into
decimals of an hour?

Example:

13:00 to 13:54 is 0.9 hrs ?

Use DateDiff() to calculate the difference in minutes, and divide by
60:

DateDiff("n", [starttime], [endtime]) / 60.

You can use the Round() function to round this quotient to one or two
decimal places if you wish.


.
 
G

Guest

Nevermind! Got it!

-----Original Message-----
How can I write a function to calculate the difference
between two times on a form and then turn it into
decimals of an hour?

Example:

13:00 to 13:54 is 0.9 hrs ?

Use DateDiff() to calculate the difference in minutes, and divide by
60:

DateDiff("n", [starttime], [endtime]) / 60.

You can use the Round() function to round this quotient to one or two
decimal places if you wish.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top