Oracle: How to string to date with milliseconds

1136970 pts.
Tags:
ORA
Oracle
I'm trying to convert the following string to date in Oracle:
2004-09-30 23:53:48,140000000
I've already using this:
to_date('#', 'YYYY-MM-DD HH24:MI:SS,FF9')
But I keep getting this error message:
ORA-01821: date format not recognized.
Would anybody have a suggestion on what I should do here?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

I think you should use to_timestamp function.

Example:
select to_timestamp('2004-09-30 23:53:48,140000000', 'YYYY-MM-DD HH24:MI:SS,FF9')
from dual
Result:
30.9.2004 23:53:48,140000000
Read more about Oracle date format elements here.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • carlosdl
    Yes, if you need millisecond precision, a timestamp is what you need, not a date.
    84,670 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: