Home » SQL & PL/SQL » SQL & PL/SQL » char to timestamp conversion (10G, unix)
char to timestamp conversion [message #600551] Thu, 07 November 2013 14:29 Go to next message
babhuko
Messages: 49
Registered: December 2011
Location: Chennai
Member
Hi all,

How to convert the below timestamp format to dd-mon-yyyy hh24:mi:ss

'Sunday, October 06, 2013 9:46:57 AM'

Thanks,
Babhuko
Re: char to timestamp conversion [message #600552 is a reply to message #600551] Thu, 07 November 2013 14:34 Go to previous message
Solomon Yakobson
Messages: 3273
Registered: January 2010
Location: Connecticut, USA
Senior Member
I see no timestamp. All I see is a string. And storing dates as string isn't a good idea. If you'd store it as DATE you wouldn't have all these issues. Anyway:

SELECT  TO_CHAR(
                TO_DATE(
                        'Sunday, October 06, 2013 9:46:57 AM',
                        'FMDay, Month dd, yyyy hh:mi:ss AM'
                       ),
                'dd-mon-yyyy hh24:mi:ss'
               ) dt
  FROM dual
/

DT
--------------------
06-oct-2013 09:46:57

SCOTT@orcl > 


SY.
Previous Topic: How to allow only numbers where condition substr(Object_id,7,10)
Next Topic: How to count different items with one sentence instead of above?
Goto Forum:
  


Current Time: Wed Apr 24 14:17:48 CDT 2024