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: date format question

Re: date format question

From: James Petts <jpetts_at_celltech.co.uk>
Date: Wed, 21 Apr 1999 07:27:15 GMT
Message-ID: <371d7af1.2236050821@right.celltech>


On Tue, 20 Apr 1999 17:52:21 -0500, Rajan <sestri_at_hotmail.com> wrote:

>Change the NLS_DATE_FORMAT in the client machine's registry to
>'dd-mon-yyyy'.
>This will solve the problem..
>
>Gennady wrote:
>
>> Could anybody give me a hint how to change
>> date type data format from 4/20/99 12:50:54
>> to 20-APR-99 (only date, no time)?

The above answer assumes a Windoze client accessing the data, and using lower case 'mon' will actually return 'apr' not 'APR'.

A more general solution is to use the format the date when you actually access it using the TO_CHAR function. Saying something like:

TO_CHAR(<date_variable>, 'DD-MON-YY')

will give you what you are asking for.  

Use SQL*Plus and type:

SELECT TO_CHAR(sysdate, 'DD-MON-YY')
  FROM dual;

to see how it works. BTW, you might want to consider returning a 4-digit year, rather than a 2-digit year. If so, use YYYY instead of YY in the format specification string. Take a look in the SQL Language Reference Manual index for 'Date format models' for options you can use when displaying a date. Received on Wed Apr 21 1999 - 02:27:15 CDT

Original text of this message

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