Convert Java util.Date to sql.Date

Submitted by:Tim Kelly

Date added:19 December, 2012

Category:Java

How to convert a java util Date into a sql Date for use in databases.

Tags: convert date

Code Snippet:

java.util.Date utilDate = new java.util.Date();
java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
 
 

Comments