Lapsed time Function

ddrew

seasoned user
Local time
Today, 21:21
Joined
Jan 26, 2003
Messages
911
Im trying to create a Lapsed time Function. Ive searched the forum and am currenlty trying this

Me.LunchLapsedTime =Nz([LunchStartTime] - [LunchFinishTime)

Me.LunchLapsedTime is a textbox. The other two are Date/Time boxes. The result im getting is about right, (4 minutes when I pressed the button and it is updating everytime i press it). But the whole answer is -4.71064814337296E-03. I thought it was case of decimel places but I adjusted that to 0 and still got the same answer!
 
To start with, I think you have your math backward which would account for you getting a negative value. Second, the time part of the variant is going to be on the right side of the decimal (the day part is on the left). Third, the e-03 means you need to move the decimal to the left 3 places to see the real value (this is called scientific notation - I think :)).

So.... After you correct your math, you should be able to see the actual seconds by formatting what you have as seconds using something like Format(xxx, "h:m:s")
 
Ken I tried what you said and I got rid of the negative sum, but I couldn't correct the rest. I tried this:

Me.LunchElapsedTime = DateDiff("M", LuchFinishTime, LunchStartTime)

Now I always get a 0 result!
 
I think you need 'n' instead of 'M' for minutes...

???
 
As you've found out, some of the interval designations are not very intuitive! "m" is month with "n" being used for minutes, as mentioned. "w" is weekday, with "ww" being used for week. Having a mother that cooked with aluminum pots and pans, I always move the cursor into the DateDiff function name and hit F1 to double-check the intervals!

Linq
 
As you've found out, some of the interval designations are not very intuitive! "m" is month with "n" being used for minutes, as mentioned. "w" is weekday, with "ww" being used for week. Having a mother that cooked with aluminum pots and pans, I always move the cursor into the DateDiff function name and hit F1 to double-check the intervals!

Linq

I need a F1 button on my mouse - ! :):)
 

Users who are viewing this thread

Back
Top Bottom