File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes db date value problam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "db date value problam" Watch "db date value problam" New topic

db date value problam

raj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 96
hi all,
i am using mysql db.i have stored the date in mysql table using
now().it stored as : 2006-09-18 11:38:03

But when i retrieved that value using jdbc in my application it is adding zero at the end. like : 2006-09-18 11:38:03:0

can all guess why it is happening like this.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30067

It is giving you the value to second precision. You can use SimpleDateFormat to format it without the milliseconds.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: db date value problam
Similar Threads
Running application on web start
How to store arraylist in xml file
can you do that in one query?
Query problem with MySQL 5
UnsupportedClassVersionError, Can the good people help