Solved

getting date and time from Oracle

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java stored proc example 9 46
maven module vs maven project 3 47
How to convert from xls to xlsx using java 7 56
passing enum to a method 4 23
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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 …

820 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