It's not a secret anymore!
The moose likes JDBC and Relational Databases 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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
author & internet detective

Joined: May 26, 2003
Posts: 32819

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

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: db date value problam
It's not a secret anymore!