Re: DateTime Format Elements
From: J.P. <jp_boileau_at_yahoo.com>
Date: 3 Jun 2002 06:38:06 -0700
Message-ID: <7e388bc3.0206030538.25658d75_at_posting.google.com>
Date: 3 Jun 2002 06:38:06 -0700
Message-ID: <7e388bc3.0206030538.25658d75_at_posting.google.com>
Just a little bit of date manipulations will get you the results you want... Here:
SELECT
mydate,
TRUNC((mydate + 7 -
next_day(last_day(add_months(mydate, -1))+1, 'MONDAY')) /7) + 1
"Week#"
FROM
dttest
I made the assumption that hte week starts on Monday. You can change that if you want, just replace with the appropriate day-of-the-week.
JP