In a message dated 00-06-01 08:36:35 EDT, you write:
I’m trying to get the resolution time between two date columns in Oracle 8.0.5 :
for each record i have the fields END_DATE and START_DATE.
I can I do it in BO ?
Do I need to create a view, function, ??? does anyone know a fast solution
?
Do you have access to the universe design? If so, simply subtract the two dates i.e. END_DATE - START_DATE. The resulting object will be a numeric value, where the integer portion will be the number of days and the decimal portion is the fraction of a day. In other words, 1.5 means 1 1/2 days or a total of 36 hours.
If you do not have access to the universe design then you are going to have to subtract the two dates in the client instead. The problem here is that while BusObj provides the DaysBetween() function, it does not process times. So instead of 1.5 days (from the prior example) you would only get 1.0.
If you really need to get the time, the solution I have come up with is to convert the date value to a string, substring all of the different parts of the time, convert everything back to numeric values, convert everything to a common factor (seconds, minutes, hours… all become seconds), and then do the subtraction. Then convert everything back to a unit of choice.
An ugly formula follows… replace DATE1 and DATE2 as appropriate:
=((( (ToNumber(SubStr(FormatDate( ,“HH:MM:SS”) ,1 ,2))6060) + (ToNumber(SubStr(FormatDate( ,“HH:MM:SS”), 4, 2))* 60) + ToNumber(SubStr(FormatDate( ,“HH:MM:SS”), 7, 2))) - ( (ToNumber(SubStr(FormatDate( ,“HH:MM:SS”) ,1 ,2))6060) + (ToNumber(SubStr(FormatDate( ,“HH:MM:SS”), 4, 2))* 60) + ToNumber(SubStr(FormatDate( ,“HH:MM:SS”), 7, 2)))) / 3600) + (DaysBetween( ,)*24)
- Translate time portion of date to a character string with FormatDate() 2. Use SubStr() to strip out the time information as Hours, Minutes, and Seconds
- Use ToNumber() to translate each component back to a number 4. Multiply by an appropriate factor to translate each time component into seconds
- Subtract the two numbers
- Translate result back into hours by dividing by an appropriate factor 7. Add the number of hours per day obtained from DaysBetween() * 24
Have fun…
Regards,
Dave Rathbun
Integra Solutions
www.islink.com
Listserv Archives (BOB member since 2002-06-25)