[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MySQL - getDate() - no time !

Posted on 2005-04-23
6
Medium Priority
?
3,103 Views
Last Modified: 2008-01-09
Hi

I have a DATETIME column in my database, i have checked using mysql and its is storing the data and time portion.. i am using RecordSet.getDate but only getting back the date portion. how do i get the date and time

-P
0
Comment
Question by:makerp
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:RomanRega
ID: 13850702
Can't you call getTime() ??
0
 
LVL 3

Expert Comment

by:RomanRega
ID: 13850711
Or try something like this:

new java.util.Date( yourRecordSet.getDate( column ).getTime() );
0
 
LVL 15

Accepted Solution

by:
aozarov earned 500 total points
ID: 13850946
>> new java.util.Date( yourRecordSet.getDate( column ).getTime() );
That will not work. java.sql.Date holds only the date part. you should call getTimestamp instead.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 15

Expert Comment

by:aozarov
ID: 13850954
>> getDate( column ).getTime() ...
That is a bad example from the JDK where they should not have extend java.util.Date (getTime comes from there but is meaningless), but rather use Containment...
0
 
LVL 10

Author Comment

by:makerp
ID: 13850970
cheers :)
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13850993
:-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

872 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