Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateDiff and time formatting 1

Status
Not open for further replies.

tlove161

Technical User
Feb 5, 2004
42
US
I have a calculated field with the expression [OP DUR]: DateDiff("n",[START TIME],[END TIME]). This gives me the difference between the two values in minutes. I need the answer to be in "hours:minutes" format.

I tried Format([OP DUR], "hh:nn") in another field and the result is always "00:00". If the difference is 270 minutes, I want the field to show "4:30". I know this is possible but I can't figure it out. Thanks.
 
Do a search in this forum and the other Access and VBA fora and you will find roughly 63,000,000 threads discussing this. Add the keyword 'mod' to your search to narrow it down some.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thank you for the help. I got this to work after searching. OP_DUR: Format([OP DUR]\60,"00") & ":" & Format([OP DUR] Mod 60,"00")
 
Does that make this thread 63,000,001?

It IS good to learn to use Advanced Search and also useful to peruse the FAQ's for each forum...

In case you didn't find it, yet:

[OP DUR]: Int(DateDiff("n",[START TIME],[END TIME])/60) & ":" & Format(DateDiff("n",[START TIME],[END TIME]) Mod 60,"00)



HTH,
Bob [morning]
 
Something like this (without Mod) ?
[OP DUR]: Format(DateDiff("n",[START TIME],[END TIME])/1440,"hh:nn")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top