
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Difference between two dates (in hours)
I have a date column, let's say Order_Date, which comes from the load of an excel sheet through one of my scripts.This column is a date and its format is DD/MM/YYYY.
What I would like to do is calculate the difference between the maximum and minimum dates in hours. So I have done the following:
(Interval(Max(Order_Date)-Min(Order_Date),'DD') * 24
Is that correct?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This should work
Interval(Max(Order_Date) - Min(Order_Date),'DD') * 24
or you can try this:
Interval(Max(Order_Date) - Min(Order_Date), 'h')

.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Interval() function is just a formatting function, so you don't need it in Sunny's first formula. (Doesn't do anything bad, either...). So if you use
(Max(Order_Date) - Min(Order_Date)) * 24
you will get a number corresponding to the number of hours.
And if you use
Interval(Max(Order_Date) - Min(Order_Date), 'h')
you will get the number of days, but formatted as hours. E.g. if the difference between min and max is exactly 10 days, the underlying value will be 10, but its textual representation will be '240'.
HIC
