Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get Day of week
It depends on what you want back. If you want the day in text form, then
"DY","Dy","dy" yields a three char abbreviation ie FRI, Fri, fri. "DAY",
"Day", "day" yields the day fully spelled out with matching capitalization.
This could be decoded if a number is required. Or your function could query
v$nls_parameters for the value of the nls_territory.
HTH
James
In article <3728c614_at_news.uk.ibm.net>,
"Nicolas Bronke" <news_at_TRINITY.de> wrote:
> How can I get the Day of a week via Oracle functions?
>
> I tried using a function like
>
> Create or replace function DAYOFWEEK (DTTAG IN DATE)
> RETURN NUMBER
> AS
> TAG NUMBER;
> VALUE DATE;
> BEGIN
> VALUE :=trunc(dtTAG);
> TAG := TO_NUMBER(TO_CHAR(VALUE,'D'));
> RETURN TAG;
> END DAYOFWEEK ;
>
> That works fine, but it depends on the NLS_TERRITORY. That means using
> Territory = America the week starts with sunday, using german the week
> starts with monday.
>
> Does exists a better solution, which is independend from the territory?
>
> Kind regards
> Nicolas Bronke
>
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Apr 29 1999 - 17:17:21 CDT
![]() |
![]() |