permaculture playing cards*
The moose likes JDBC and the fly likes Working with dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Working with dates" Watch "Working with dates" New topic

Working with dates

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
Does anyone have any suggestions for working with dates that will be stored in a MySQL database?
For example, I want to create a subscription service and store an expiration date in the database.
Should I create the date in Java and then store it in the database or should I have mySQL create the date for me (if that's possible)?
I suppose I'm going to have to convert the date back to a Java object in order to work with it, right?
Any thoughts?
Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
You can use the timestamp data type, I found this at
The TIMESTAMP column type provides a type that you can use to automatically mark INSERT or UPDATE operations with the current date and time.
jQuery in Action, 2nd edition
subject: Working with dates
Similar Threads
java.sql.Date '0000-00-00' problem
Date Format
Stumped By HashSet
Lists inside SQLite
Date Differences.