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 -> confusing date question

confusing date question

From: Cynic <ksd9_at_yahoo.com>
Date: Mon, 22 Jul 2002 10:32:27 -0400
Message-ID: <ujo5lph3aqop76@corp.supernews.com>


I have a script that updates dates on a db. However, now I am supposed to take into account the day of the week. So, for example, if the date is July 7, 1999 (Wednesday) I need to update to July 7, 2001. HOWEVER: if July 7, 2001 is NOT a thursday, but a SATURDAY, I need to make it a non-weekend work day. So here is what I need to do:

July 7, 1999 ---->>> July 9, 2001 (this is the first work day following July 7, 2001)
So, I guess I am adding 2 years here PLUS whatever it will take to get the day to the work week.
Any suggestions?

Here is what I have so far (doesn't take into consideration the whole weekend thing):

UPDATE GL_ACCT_SCHED SET EFF_DT = ADD_MONTHS(EFF_DT, (TRUNC((MONTHS_BETWEEN( TO_DATE('31-DEC-2000', 'DD-MON-YYYY'), EFF_DT))/12,0)*12)+12) where MONTHS_BETWEEN(TO_DATE('01-JAN-2001', 'DD-MON-YYYY'), EFF_DT) > 0; Received on Mon Jul 22 2002 - 09:32:27 CDT

Original text of this message

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