File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
java.util.Date does it contain information about hours?
Tristan Van Poucke
Joined: Jun 30, 2008
Aug 28, 2008 12:06:00
When I write a Date() object to my Mysql database, I get the date correct but not the exact time, I always get f.e 2008-07-05 00:00:00 or 2008-08-22 00:00:00 How can you make sure to get the exact hour,minute and second?
Joined: Oct 14, 2005
Aug 28, 2008 12:15:00
You could review the type of the column to see if it is the correct type to hold a timestamp. Or you could review the code that inserts into that table to see if it's inserting a timestamp correctly.
Post more information if those two hints don't get you anywhere.
Joined: Oct 27, 2005
Aug 28, 2008 13:34:00
There are three date/time types in
- Date stores only the date part
- Time stores only the time part
- Timestamp stores both
So switch to Timestamp (if your backing field allows it).
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: java.util.Date does it contain information about hours?
string to date parsing ....
SEVERE: BAD packet signature 200,SEVERE: Caught exception (java.lang.NullPointerException)
Java Date formatting problem
How do i format a string to date
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014