BusinessObjects Board

Compare Dates in hours

I have two dates in my Webi report:
Date A (11/20/2009 9:00am)
Date B (11/21/2009 11:00am)

I need to compare Date A and Date B, and see if they are within 24 hours. I tried this =DaysBetween([Date A];[Date B]), but it only compares the date part and returns the value in days. For the above two dates sample, it retruned 1. However, they are not winthin 24 hours.

And using (Date A - Date B) is not valid. Please help! Thanks.


vanessa (BOB member since 2009-01-20)

Hi Vanessa,

you can do this at database level by creating the object in the Universe as:
(DATE A - DATE B) * 86400
This will give you the result in seconds.
For hours you can use:(DATE A - DATE B)*3600

This syntax is for the oracle database. Hope it helps you.


rohit12 :india: (BOB member since 2008-11-08)

Hi,

Here is a solution for a similar problem in DeskI:

Maybe some tweaking is needed to convert the functions from Deski to Webi and to change the formula to calculate the difference as the number of hours. Then from there you can do an easy check whether it’s within 24 hours or not.


Marek Chladny :slovakia: (BOB member since 2003-11-27)