aspose file tools*
The moose likes JDBC and the fly likes Unable to Convert in Timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unable to Convert in Timestamp" Watch "Unable to Convert in Timestamp" New topic
Author

Unable to Convert in Timestamp

Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

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 - Every great individual common man
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
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

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://aspose.com/file-tools
 
subject: Unable to Convert in Timestamp