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: Convert Day of week (DY) to actual date

Re: Convert Day of week (DY) to actual date

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Thu, 19 Aug 2004 20:12:00 +0200
Message-ID: <cg2q5b$33o$1@news3.tilbu1.nb.home.nl>


Mark C. Stock wrote:

[snip!]
>
>
> study date functions and format specifications in the SQL Reference manual
> before you go any further -- don't rely on partial examples in Oracle how-to
> books

But I do, I do! - If it's not in as an example, it does not work. At least, that's the axioma I live by, and I haven't been disappointed yet.
I have slapped my hand against the forehead (where there is surprisingly little hair, lately :)), mumbling "see - no examples! NO examples!"
>
> you'll find that oracle will not convert an arbitrary day-of-week into a
> date, because it does not make any assumptions about which Monday (or
> Tuesday, etc.) you're interested in
>
> however, you'll find that you can use SYSDATE, date arithmetic and the
> NEXT_DAY function to return a date for a specific day of the week as of a
> certain starting date
>
> to save us all time (but you better look it up to make sure you know how it
> works) you need something like:
>
> next_day(trunc(sysdate)-7,day_of_week_column)
>
> ++ mcs
>
>

-- 

Regards,
Frank van Bortel
Received on Thu Aug 19 2004 - 13:12:00 CDT

Original text of this message

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