Hi, I have a problem. I will calculate the days, hours, minutes and seconds between two dates.
1.) Table with columns Name (char), Login (datetime) and Logout (datetime)
name login logout
omuth 2010-03-29 07:00:00 2010-03-29 07:00:30
Fritz 2010-03-28 07:00:00 2010-03-29 09:35:43
Harry 2010-03-25 08:00:00 2010-03-26 07:45:00
2.) First Report-Level Variable “TEST”
=DaysBetween(<login> ,<logout>) * 86400 + ( ToNumber(FormatDate(<logout> ,"HH")) * 3600 + ToNumber(Left(FormatDate(<logout> ,"mm:ss") ,2)) * 60 + ToNumber(FormatDate(<logout> ,"ss")) )-( ToNumber(FormatDate(<login> ,"HH")) * 3600 +
ToNumber(Left(FormatDate(<login> ,"mm:ss") ,2)) * 60 + ToNumber(FormatDate(<login> ,"ss")) )
3.) Second Report-Level Variable “TIME”
=FormatNumber(Floor(<TEST>/86400) ,"0") & " day(s) " &
FormatNumber(Floor(Mod(<TEST> ,86400)/3600) ,"00") & ":" &
FormatNumber(Floor(Mod(Mod(<TEST> ,86400) ,3600)/60) ,"00") & ":" &
FormatNumber(Mod(Mod(Mod(<TEST> ,86400) ,3600) ,60) ,"00")
4.) The result from the variable is:
omuth 0 day(s) 00:01:30 (correct: 0 day(s) 00:00:30)
Fritz 1 day(s) 03:36:43 (correct: 1 day(s) 02:35:43)
Harry 1 day(s) 24:45:00 (correct: 0 day(s) 23:45:00)
Please help me!!
omuth
System
BusinessObject Enterprise XI 3.1
Database: Informix 11.5
omuth (BOB member since 2003-04-28)