Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Adviise please

Re: Adviise please

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 21 Oct 2005 10:03:05 -0700
Message-ID: <43591f49$1@news.victoria.tc.ca>


maruf.zubaer_at_citigroup.com wrote:
: I need assistance in creating an oracle function which will calculate
: DateTimeDiff in hours excluding weekends and holidays
: So if Statdate is 10/10/05 08:15:00 and EndDate 10/10/05 13:15:00 the
: result we get is 5.00 hrs

One straight forward approach

find the hours left in the first day

        if the first day is not a holiday or a weekend then add them

now loop through each day until the penultimate

        if each day is not a holiday or a weekend then add 24 hrs

find the hours taken up in the last day

        if the day is not a holiday or a weekend then add those hrs also

How you decide a day is a weekend is to use one of the date functions that tells you which day it is (mon, tue, etc).

How you decide a day is a holiday is your problem.

Mr. Morgan showed a few sample date calculations to get you started on the syntax and a few basic ideas that are involved in oracle date calculations.

--

This programmer available for rent.
Received on Fri Oct 21 2005 - 12:03:05 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US