Page 1 of 1

calculate number of days excluding weekends

Posted: Mon Nov 27, 2006 2:06 pm
by sudheer05
Hi,
My input has two timestamps,I need to calculate the number of days between these two timestamps excluding weekends.
Any help would be appreciated.
My source is Orcale.
ThankYou,
Sudheer.

Posted: Mon Nov 27, 2006 2:08 pm
by ray.wurlod
You can use Oracle functions or you can use DataStage.
If you use DataStage you will need either a (parallel) routine or a calendar table to determine which days are weekends. This is particularly true if your requirement extends the definition of "weekend" to include "holiday".

Posted: Tue Nov 28, 2006 11:15 am
by sudheer05
Thanks Ray,
Yes I do have a Calender Table which has a Calendar date and a flag field which tells me if it is a working day or a holiday.
But I need some help to count these flags for which this calendar date lies between my date1 and date2 from the source.
ThankYou.

Posted: Tue Nov 28, 2006 11:25 am
by roy
Hi,
I was wondering how can a 7.5.1a be parallel?
It certainly can't run those kind of jobs!

Most simple way is to use a sql join to calculate it from the calendar table

IHTH,

Posted: Tue Nov 28, 2006 1:06 pm
by ajith
select count(*) from Hol_Tab where hol_ind <>'Y'

or something like that?


It is just a matter of a query anyway