Time difference between two times (1 Viewer)

jjake

Registered User.
Local time
Today, 06:07
Joined
Oct 8, 2015
Messages
291
HI,

I'm using the following to display the difference in time in minutes

=DateDiff("n",[timein],[timeout])

My question is how do i use it to display in either

decimal hours- 1.5 hours
hours and minutes - 1:30

for 1 hour 30 minutes
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:07
Joined
Oct 29, 2018
Messages
21,357
Hi. It would be easier with a function that does basically something like this.
Code:
=Datediff(“n”, [timein],[timeout])\60 & “ hours “ & Datediff(“n”,[timein],[timeout]) Mod 60 & “ minutes”
Sent from phone...
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:07
Joined
Aug 30, 2003
Messages
36,118
You can divide that by 60 to get a decimal result.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:07
Joined
Sep 21, 2011
Messages
14,038
Divide by 60 for the first one?
Use Int for whole hours and mod for remainder

FWIW I have only ever used 1.5 hours format.
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:07
Joined
Jan 23, 2006
Messages
15,361
Your code,seems correct to find the difference in minutes between timein and timeout
Code:
DateDiff("n",[timein],[timeout])

That is simply a number.
Divide your "n" minutes by 60 to get Hours.

1.5 in your example is a number and represents the time difference

1:30 represents a time -not a time difference.
 

Users who are viewing this thread

Top Bottom