G Guest Sep 9, 2005 #1 Is there a way to get time in a "short time" format from a DateDiff formula? example: Start End DIFFERENCE 5:00AM 6:30AM 1:30
Is there a way to get time in a "short time" format from a DateDiff formula? example: Start End DIFFERENCE 5:00AM 6:30AM 1:30
G Guest Sep 9, 2005 #2 Get the different in minutes, and then devide by 60 datediff("n",StartTime, EndTime)/60
G Guest Sep 9, 2005 #3 That will give you 1.5 and not 1:30 Ofer said: Get the different in minutes, and then devide by 60 datediff("n",StartTime, EndTime)/60 Click to expand...
That will give you 1.5 and not 1:30 Ofer said: Get the different in minutes, and then devide by 60 datediff("n",StartTime, EndTime)/60 Click to expand...
G Guest Sep 9, 2005 #4 OK, OK Try this, mybe there is a better way, but I can't think of one =datediff("h","5:00AM", "6:30AM") & ":" & datediff("n","5:00AM", "6:30AM") - datediff("h","5:00AM", "6:30AM")*60
OK, OK Try this, mybe there is a better way, but I can't think of one =datediff("h","5:00AM", "6:30AM") & ":" & datediff("n","5:00AM", "6:30AM") - datediff("h","5:00AM", "6:30AM")*60
D Douglas J Steele Sep 9, 2005 #5 Since Time is stored as a fraction of a day, you can take advantage of the fact that there are 1440 minutes in a day and use: =Format(DateDiff("n", StartTime, EndTime)/1440, "Short Time") ?Format(DateDiff("n", #05:00:00#, #06:30:00#)/1440, "Short Time") 01:30 Of course, this won't work for time differences that are greater than 24 hours.
Since Time is stored as a fraction of a day, you can take advantage of the fact that there are 1440 minutes in a day and use: =Format(DateDiff("n", StartTime, EndTime)/1440, "Short Time") ?Format(DateDiff("n", #05:00:00#, #06:30:00#)/1440, "Short Time") 01:30 Of course, this won't work for time differences that are greater than 24 hours.
T Tim Ferguson Sep 9, 2005 #6 Is there a way to get time in a "short time" format from a DateDiff formula? Click to expand... If you get the minutes, you can format it yourself: minutes = datediff("n", Time2, Time1) newOutput = Format(minutes \ 60, "0") & ":" & _ Format(minutes mod 60) Hope that helps Tim F
Is there a way to get time in a "short time" format from a DateDiff formula? Click to expand... If you get the minutes, you can format it yourself: minutes = datediff("n", Time2, Time1) newOutput = Format(minutes \ 60, "0") & ":" & _ Format(minutes mod 60) Hope that helps Tim F
G Guest Sep 12, 2005 #7 Thanks. Douglas J Steele said: Since Time is stored as a fraction of a day, you can take advantage of the fact that there are 1440 minutes in a day and use: =Format(DateDiff("n", StartTime, EndTime)/1440, "Short Time") ?Format(DateDiff("n", #05:00:00#, #06:30:00#)/1440, "Short Time") 01:30 Of course, this won't work for time differences that are greater than 24 hours. Click to expand...
Thanks. Douglas J Steele said: Since Time is stored as a fraction of a day, you can take advantage of the fact that there are 1440 minutes in a day and use: =Format(DateDiff("n", StartTime, EndTime)/1440, "Short Time") ?Format(DateDiff("n", #05:00:00#, #06:30:00#)/1440, "Short Time") 01:30 Of course, this won't work for time differences that are greater than 24 hours. Click to expand...