• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Representing MilliSeconds in JDBC using Oracle

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Friends
In my JDBC application i have to display date, and time along milliseconds.
I am using oracle database.
The below query will display date and time.
select to_char(d,'YYYY-MM-DD hh24:MI:SS') from datetest;

In Oracle can we show Milliseconds along with date and time ?
Just now i searched in oracle documentation.
and i didnot found the reference to represent milliseconds.
is it possiblt to represent the milli seconds in oracle ?
if anybody knows [query ]the format to show milliseconds also please tell me.
i need to represent milliseconds also in my application.
Thanks in advance
Yours
Rajesh
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps this is precisely what you're trying to avoid having to do, but if I were you, I would query the database for the raw date column, then use ResultSet.getDate() to get the date, and then format it manually.
 
Rajesh Kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Jesper Ottosson,
Please tell me how to use ResultSet.getdate() and how to format the database data accordingly.
I am new to Java
Thanks in advance
Yours
Rajesh

Originally posted by Jesper Ottosson:
Perhaps this is precisely what you're trying to avoid having to do, but if I were you, I would query the database for the raw date column, then use ResultSet.getDate() to get the date, and then format it manually.

 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rajesh:
I don't think the Oracle date datatype stores the time to the millisecond. From what I've read from my Oracle 8i manuals, there is no millisecond value stored in the database, so it wouldn't be possible to retrieve it. One work around could be to store a long value in an Oracle Number datatype that represents the java.util.Date in milliseconds.

This is a workaround if you can't find the date solution. You may want to post this question in the javaranch Oracle forum for an Oracle expert opinion.
Jamie
[This message has been edited by Jamie Robertson (edited December 10, 2001).]
[This message has been edited by Jamie Robertson (edited December 10, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic