Solved

getting date and time from Oracle

Posted on 2004-04-01
4
347 Views
Last Modified: 2010-03-31
Hey,

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:

resultset.getDate("date_column")

anyone know the best way of retaining the time portion of the date?
0
Comment
Question by:peterwnorman
  • 4
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 10733821
Use

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

Expert Comment

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

Expert Comment

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

should of course be

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

Expert Comment

by:CEHJ
ID: 10734586
8-)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 38
object oriented programming comparison 5 69
Java string replace 11 43
Adding multiple JVM environments to RedHat 6 7 18
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

776 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