time difference function

  • Thread starter Thread starter Em
  • Start date Start date
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 ?
 
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.
 
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.


.
 
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.


.
 
Back
Top