Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: to_char syntax
Randy Harris wrote:
>"Liz J" <thejordanschangethistoanatsignclara.net> wrote in message
>news:1140653404.29042.0_at_damia.uk.clara.net...
>
>
>>Hi
>>
>>Could someone help me with some syntax?
>>
>>I know that
>>
>>SELECT To_char (sysdate, 'ddth Month YYYY')
>>
>>will give me the format I want if it is today's date that I need.
>>
>>But suppose it is another date that I know - say 3rd February 2006?
>>
>>I can't get the syntax right.
>>
>>thanks
>>
>>Liz
>>
>>
>>
>
>
>How about:
>
>To_char ('03-Feb-2006', 'ddth Month YYYY')
>
>
>
That might work, but it relies on an implicit type conversion of the
literal string '03-Feb-2006' into a valid date, and assumes that the
default NLS_DATE_FORMAT string is set to 'dd-mon-yyyy'.
A safer method would be
to_char(to_date('03-Feb-2006', 'dd-mon-yyyy'), 'ddth Month YYYY')
Received on Thu Feb 23 2006 - 09:41:15 CST