Home » SQL & PL/SQL » SQL & PL/SQL » convert string to date
convert string to date [message #614461] Wed, 21 May 2014 22:01 Go to next message
rlsublime
Messages: 10
Registered: March 2014
Junior Member
I have the field 'date' and value 'May 20 2014' and it is a character field. I am trying to get it to display the date as '20-05-14'. How can I do this? Thanks
Re: convert string to date [message #614462 is a reply to message #614461] Wed, 21 May 2014 22:07 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
SQL> select to_char(to_date('May 20 2014','Mon DD YYYY'),'DD-MM-YYYY') from dual;

TO_CHAR(TO
----------
20-05-2014




Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and please read http://www.orafaq.com/forum/t/174502/102589/
Re: convert string to date [message #614467 is a reply to message #614461] Thu, 22 May 2014 00:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

If your field contains a date it should be of DATE datatype.

Re: convert string to date [message #614473 is a reply to message #614461] Thu, 22 May 2014 01:11 Go to previous message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
A good read for you, have a look http://edstevensdba.wordpress.com/2011/04/07/nls_date_format/
Previous Topic: How to group days in a week
Next Topic: randomize records and groupby date.
Goto Forum:
  


Current Time: Fri Apr 26 10:07:55 CDT 2024