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

Home -> Community -> Usenet -> c.d.o.misc -> Re: DAYOFWEEK Function

Re: DAYOFWEEK Function

From: mcstock <mcstock_at_enquery.com>
Date: Thu, 23 Oct 2003 17:13:16 -0400
Message-ID: <drGdnanLxeoa2QWiRVn-gw@comcast.com>


consider to_char(<adatevalue>,'DY') to return the 3-character day name -- in the language specified by the NLS parameters you can also add a 3rd parameter in the form ;'NLS_DATE_LANGUAGE = <a valid language>' to specify what language to work with in your code.



Mark C. Stock
www.enquery.com
(888) 512-2048

"Paul Dixon" <root_at_127.0.0.1> wrote in message news:bn86ue$kqs$1_at_visp.bt.co.uk...
>
> "Mark D Powell" <Mark.Powell_at_eds.com> wrote in message
> news:2687bb95.0310220451.8a68332_at_posting.google.com...
> > "Anna C. Dent" <anacdent_at_hotmail.com> wrote in message
> news:<gGklb.79762$Ms2.41140_at_fed1read03>...
> > > Alister Taylor wrote:
> > >
> > > > Dear All,
> > > >
> > > > I am having a little (trans: a LOT) of trouble geeting a DayofWeek
> > > > function to work.
> > > >
> > > > Broadly, this is for a basic flight booking service, which
stipulates
> > > > that a given flight is to be made on a certain daynumber.
> > > >
> > > > A flight may be made on many dates, but must be on this daynumber.
I
> > > > think that the problem may lie in part with the date entered as ie
> > > > '27/OCT/2003', but this seems not to be causing problems for other
> > > > people within the group.
> > >
> > > Please note that Oracle is 'picky' when it comes to data types.
> > >
> > > '27/OCT/2003' is a STRING; just as is 'ABC'.
> > >
> > > You might want to look up the TO_DATE function.
> >
> > Alister, here is an example statement to help you out.
> > UT1> l
> > 1 select to_char(sysdate,'DDD') as DayOfYr,
> > 2 to_char(sysdate,'D') as DayOfWk,
> > 3 to_char(sysdate,'YYYYMMDD') as ToDay
> > 4* from sys.dual
> > UT1> /
> >
> > DAY D TODAY
> > --- - --------
> > 295 4 20031022
> >
> >
> > Anna mentioned looking up the to_date function but what you probably
> > should look up is the list of "date format elements" via the index
> > used in both the to_char and to_date functions rather than the
> > functions themselves. The information on the masks elements and the
> > functions is usually separated by other material.
> >
> > HTH -- Mark D Powell --
>
> Alister,
>
> If you do use the to_char(date_value,'D') functionality as suggested by
> Mark, you need to be aware that the value it returns is affected by the
NLS
> settings of the session that's executing the code ( something the Oracle
> documentation doesn't mention) e.g. Thursday is day 4 for nls_territory
> 'UNITED KINGDOM' and day 5 for 'AMERICA'.
>
> Paul Dixon
>
>
Received on Thu Oct 23 2003 - 16:13:16 CDT

Original text of this message

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