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!

Time calculation

Status
Not open for further replies.

BillyL

IS-IT--Management
Jul 18, 2000
91
0
0
US
I would like to find the difference between two times and have it formatted as a number with two decimal places.  The expression I am using is SupportTime: [LogEndTime]-[LogStartTime].  The format I have defined in the properties is hh\:nn.  This returns the correct time in hours and minutes (2:30 or 3:45) but I would like it in decimal format (2.50 or 3.75).  Any help would be greatly appreciated.
 
Why not change SupportTime to:<br><br>=datepart(&quot;h&quot;,[LogEndTime]-[LogStartTime]) + (datepart(&quot;n&quot;,[LogEndTime]-[LogStartTime])/60)
 
Thanks for your help but it does not seem to work as expected.&nbsp;&nbsp;The division by 60 seems to cause problems.&nbsp;&nbsp;If I write simply =datepart(&quot;n&quot;,[LogEndTime]-[LogStartTime]) it returns the correct number of minutes (3:00-2:00 = 0; 11:30-9:00 = 30).&nbsp;&nbsp;If I add the /60 as you suggested =datepart(&quot;n&quot;,[LogEndTime]-[LogStartTime]/60)I get results that I really can't figure out (3:00-2:00 = 46; 11:30-9:00 = 21).&nbsp;&nbsp;Any ideas?
 
I've used this format, it should work:<br><br>=(([LogEndTime]-[LogStartTime])*24)&nbsp;&nbsp;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top