java.sql.Date is usually used in communication between Java application and MySQL. Specifically, It is used when you want to store DateTime into database, the problem is you usually use java.util.Date to present DateTime in application layer. This post will show you how to convert java.util.Date to java.sql.Date for storing into database
java.util.Date utilDate = new java.util.Date(); java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
Done!
No comments:
Post a Comment