Two Laptop Bag
The moose likes JDBC and the fly likes Unable to Convert in Timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Unable to Convert in Timestamp" Watch "Unable to Convert in Timestamp" New topic
Author

Unable to Convert in Timestamp

Ankur Sharma
Ranch Hand

Joined: Dec 27, 2005
Posts: 1234
Dear All,

I am trying to convert the given String in timestamp format using PL/SQL Language.

Here is the sql query i wrote to convert string in timestamp. But I am getting error "Ora-01810: format code appears twice" while executing the query. Please help me out and let me know what I am doing wrong while executing the query:

select to_timestamp('01/03/2007 12:01:22', 'MM/DD/YYYY HH24:MM:SS') from dual
and this one too

select to_timestamp('01/03/2007 12:01:22', 'MM/DD/YYYY HH12:MM:SS') from dual

At the same time I am able to execute the follwoing query:

select to_timestamp('2003/DEC/13 20:13:18', 'YYYY/MONTH/DD HH24:MI:SS') from dual

DO let me know where I am going wrong.


The Best way to predict your future is to create it
Ankur Sharma
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Looks like you are defining the months twice in your format. Check the docs, minutes are MI.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ankur Sharma
Ranch Hand

Joined: Dec 27, 2005
Posts: 1234
Originally posted by Paul Sturrock:
Looks like you are defining the months twice in your format. Check the docs, minutes are MI.


Oops Sorry.. i did it again....

Thanks Paul Sturrock..
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Unable to Convert in Timestamp
 
Similar Threads
Convert to timestamp yyyy-MM-dd hh:mm:ss a
JDBC - Date
Oracle SQL to get Timestamp difference
Oracle Timestamps and java.
SQLException Cursor Closed