Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No time displayed, Oracle Date field using getDate

843859May 4 2007 — edited Nov 20 2014
I am trying to get a date + time from a DATE field in an ORACLE database.

I have the following code in java:

Date dt = rs.getDate(�APPROVED_DATE�);
System.out.println(new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z").format(new java.util.Date(dt.getTime())));

The result I get is:
2007.05.04 AD at 00:00:00 EDT

If I am looking at the field value in the Database with the following function:
select to_char(APPROVED_DATE, 'Dy DD-Mon-YYYY HH24:MI:SS') from SCENARIO_COT_STATUS


this is the result I get:
Fri 04-May-2007 14:26:15

for some reason I am loosing the Time in the Java result.
Any clue what is the solution?

Thanks,

Jon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 27 2008
Added on May 4 2007
10 comments
423 views