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

Home -> Community -> Usenet -> c.d.o.server -> Re: Working days

Re: Working days

From: invalid <bill_at_invalid.com>
Date: Sat, 12 Apr 2003 14:15:35 +0100
Message-ID: <hgbUNLM3FBm+EwGO@spamnothing.co.uk>


In message <3e95b158.6044681_at_news.inet.tele.dk>, KennethKoenraadt@?.?.invalid writes
>On 10 Apr 2003 09:56:13 -0700, mmontreaux_at_hotmail.com (Monty) wrote:
>
>>Hi, can someone help me with a SQL query to calculate the date which
>>is todays date+3 non-weekend days, ie monday 01 jan+3=thursday 04 jan,
>>tuesday 02 jan+3=friday 05 jan, wednesday 03 jan+3=monday 08 jan,
>>thursday 04 jan+3=tuesday 09 jan, friday 05 jan+3=wednesday 10 jan,
>>saturday 06+3=wednesday 10 jan, sunday+3=wednesday 10 jan.
>>
>>Thank you
>>Monty
>
>Hi Monty,
>
>This is one of about a dozen ways to do it :
>
>
>select sysdate + (case when to_char(sysdate,'D') in ('1','2','7')
>then 3 when to_char(sysdate,'D') in ('3','4','5') then 5 else 4 end )
>from dual;
>

You should also be aware that to_char( date, 'D') will return a different value for Sunday depending on your nls_territory settings. Some territories use Sunday as day 1, others use Monday.

HTH
Bill Received on Sat Apr 12 2003 - 08:15:35 CDT

Original text of this message

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