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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datediff for number of minutes between two times that falls on different dates

Status
Not open for further replies.

YoBi4Ever

Instructor
Jun 5, 2007
17
KW
Dear,

I am using datediff function to get the number of miunutes between to times: Me.WorkedMinutes = DateDiff("n", [OTIn], [OTOut]) and it works oK EXCEPT when I'm computing the minutes between two times that falls in different days. for exmaple number of minutes or hours worked betwen 24.02.2013 from 16:09 to 25.02.2013 00:03 then i get -966!!

Can someone please let me know how to workaround this issue?
Thank you.
 
I get 474 with your posted DateTime values ...
 
I checked and I got -966.
Maybe it is checking between 16:06 on the 24th and 00:03 on the 24th as well!
I tried to attach screen shot but i didn't know how.

Thanks for all your help.
 
I am curious to the actual values. Can you somehow print the real values such as?
Debug.Print Format(OTin, "General Date")
Debug.Print Format(OTout, "General Date")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top