Home » SQL & PL/SQL » SQL & PL/SQL » Date Format
Date Format [message #189625] Fri, 25 August 2006 05:24 Go to next message
monasingh
Messages: 229
Registered: May 2006
Location: Mumbai
Senior Member

Hi,
I have to change the format of date value from
01/01/2006 TO 1/1/06
I have tried using
Select to_char(sysdate,'fm mm/dd/"0"rr hh:mi') from dual;

But this doesn't works if year is like 1999.
In this case the answer returned is 8/25/099.
Please advice.

Thanks ,
Mona
Re: Date Format [message #189627 is a reply to message #189625] Fri, 25 August 2006 05:34 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Try this:
Select to_char(sysdate,'fm mm/dd/fmrr hh:mi') from dual;
Re: Date Format [message #189631 is a reply to message #189627] Fri, 25 August 2006 05:42 Go to previous messageGo to next message
monasingh
Messages: 229
Registered: May 2006
Location: Mumbai
Senior Member

Thanks,
This worked Smile
Re: Date Format [message #189632 is a reply to message #189631] Fri, 25 August 2006 05:46 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Note the space between fm and mm. It will generate a space in the output. (I don't know whether this is intentionally or not)

[Updated on: Fri, 25 August 2006 05:46]

Report message to a moderator

Re: Date Format [message #189639 is a reply to message #189632] Fri, 25 August 2006 06:35 Go to previous message
monasingh
Messages: 229
Registered: May 2006
Location: Mumbai
Senior Member

Thanks Frank, there is a space. I have removed the space between fm and mm.

Regards,
Mona
Previous Topic: "dynamic" cursor
Next Topic: Host String
Goto Forum:
  


Current Time: Mon Dec 05 05:08:38 CST 2016

Total time taken to generate the page: 0.06986 seconds