BusinessObjects Board

difference in time error

good day

this is a follow up on the following thread:

I used the following code to generate the difference in time:

= 
 ( 
 ( 
 ( 
 ToNumber( Substr( FormatDate([SR_Created_At_UTC] ;"HH:mm:ss" ) ; 1 ; 2 ) ) * 60 * 60 + 
 ToNumber( Substr( FormatDate( [SR_Created_At_UTC] ;"HH:mm:ss" ) ; 4 ; 2 ) ) * 60 + 
 ToNumber( Substr( FormatDate( [SR_Created_At_UTC] ;"HH:mm:ss" ) ; 7 ; 2 ) ) 
 ) 
 - 
 ( 
 ToNumber( Substr( FormatDate( [M_IR_Created_At] ; "HH:mm:ss" ) ; 1 ;2 ) ) * 60 * 60 + 
 ToNumber( Substr( FormatDate( [M_IR_Created_At] ; "HH:mm:ss" ) ; 4 ; 2) ) * 60 + 
 ToNumber( Substr( FormatDate( [M_IR_Created_At] ; "HH:mm:ss" ) ; 7 ; 2) ) 
 ) 
 ) 
 ) / 60 + 
 ( DaysBetween( [M_IR_Created_At] ; [SR_Created_At_UTC] ) * 24 * 60 )

the results are out by a couple of seconds. an example is:
recent time - old time = x

result after calculation:
01 Apr 2018 1:55:51 PM - 01 Apr 2018 1:53:29 PM = 2:37

the results should be 02:22.

another example:
02 Apr 2018 8:12:45 PM - 02 Apr 2018 8:13:00 PM = 0:25

it should be 00:15

please assist.


roninn75 (BOB member since 2016-11-12)

0.37 * 60 = 22.2

You’re confusing minutes and decimal parts of an hour.

thank you for your response, I still don’t know how to fix it though?


roninn75 (BOB member since 2016-11-12)

You need to calculate it in two parts:

You have the whole number of minutes.

You then need to convert 37% of a minute into seconds - just multiply the remainder by 60

Have a look at this topic for further details:

got it to work thank you for your assistance.


roninn75 (BOB member since 2016-11-12)

No problem, thank you for letting us know. :+1: