Time Properties

T

Therese Bartlet

I am creating a calculated field in a query. What I want to do is
calculate the number of hours (including minutes) that have passed
between two dates. I would like the format to be hh:nn, but if it
exceeds 24 hours the default start over. For example if 30 hours and 24
minutes have elapsed I want it to look like: 30:24, but it either does
the 06:24 (rolls over after the 24 hour mark) or I can have it do the
decimal equivalent by using the DateDiff function for minutes and then
dividing by 60.

For example the first date field is in the format: 01/28/04 13:00 and
the second date field is in the format 01/29/04 14:24. I want to find
how many hours and minutes have elapsed so I want: 25:24 to be
produced.

Any suggestions?
 
S

Steve Schapel

Therese,

Try it like this...
Format(DateDiff("n",[1stDate],[2ndDate])\60,"00") & ":" &
Format(DateDiff("n",[1stDate],[2ndDate]) Mod 60,"00")
 

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