Solved

getting date and time from Oracle

Posted on 2004-04-01
4
341 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 77
Impossible to extract MSI from new JAVA releases 2 47
more than one jdk and one jre 1 30
Windows 10 IE Certificate Issue 10 41
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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…

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now