Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: elapsed time between 2 dates
In article <01bd2aae$abcd8190$863612ac_at_pw48>,
"Laura Bellini" <laura.bellini_at_compaq.com]> wrote:
>
> I was wondering if anyone out there happens to have a function that they've
> created that evaluates the elapsed time between two dates. The function I
> need to create involves taking into considering my company's business days,
> holidays, and hours, but I thought if I had a basic function to work with,
> I might be able to get a good start.
>
> I need to consider the company's business hours and holidays -- there is a
> 'holiday' table and a day table that establish working days for the
> company. By checking the inital (incoming) date against these tables, I
> would need to determine if the incoming day is a valid working day - if
> not, find the next valid working day.
>
> The incoming parameters would be a start date and an end date.
>
> Thanks in advance.
>
> Laura Bellini
> laura.bellini_at_compaq.com
That's easy since you have a table containing the business days... just select count(*) to get the number of work days.
I have developed and posted a routine that counts the days between two dates excluding Saturdays and Sundays. You might find it in www.dejanews.com (or I can send it if necessary.)
To get hours, you divide the difference between two dates by 24, and divide by 1440 for minutes. I believe Thomas Kyte has posted examples of those calculations. Again I suggest you search Deja News.
Regards,
Steve Cosner
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Tue Jan 27 1998 - 00:00:00 CST