My data is in format:
2010-12-01 09:59:00.423
getDate in Java only returns the date portion. Is there a way to also extract the time?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The SQL
DATEtype indeed only contains the date portion, not the time. But your column is apparently ofTIMESTAMPtype, so to get the full timestamp, useResultSet#getTimestamp()instead.It returns
java.sql.Timestampwhich is a subclass ofjava.util.Date, so the upcast is safe.