Solved

getting date and time from Oracle

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
array220 challenge 8 45
What is the latest versions eclipse neon 2 117
solarwind tftp server 2 30
github account with ecipse 1 16
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…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 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

11 Experts available now in Live!

Get 1:1 Help Now