getting date and time from Oracle

Posted on 2004-04-01
Last Modified: 2010-03-31

I'm running a query that returns a date column from an oracle db but the time part of it gets truncated when i use:


anyone know the best way of retaining the time portion of the date?
Question by:peterwnorman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 10733821

Timestamp t = rs.getTimestamp(1);
java.util.Date date = new Date(t.getTime());
LVL 86

Expert Comment

ID: 10733827
(where 'rs' is your ResultSet)
LVL 86

Expert Comment

ID: 10733838
>>java.util.Date date = new Date(t.getTime());

should of course be

java.util.Date date = new java.util.Date(t.getTime());
LVL 86

Expert Comment

ID: 10734586

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ejb on wildfly 5 61
Selenium docs api java index 3 94
spring maven example issues 3 92
ArrayList Adding/settign data 3 33
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question