getting date and time from Oracle

Posted on 2004-04-01
Medium Priority
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 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 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 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…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

752 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