wood burning stoves 2.0*
The moose likes JDBC and the fly likes Java Date to MySQL Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java Date to MySQL Date" Watch "Java Date to MySQL Date" New topic
Author

Java Date to MySQL Date

Tulika Shil
Greenhorn

Joined: Jan 09, 2012
Posts: 3
I want to insert the date into one of the columns of a table in MySQL from my jsp page. The datatype of that column is 'date'. How to convert the Java date to MySQL date?
ravi varagani
Greenhorn

Joined: Mar 20, 2013
Posts: 1
Date date = new Date();
SimpleDateFormat sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currentdate = sdf.format(date);
The cuurrentdate put into columns.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java Date to MySQL Date