DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Java: Util.Date To Sql.Date

06.18.2008
| 42532 views |
  • submit to reddit
        /* This snippet shows how to convert a java util Date into a sql Date for use in databases */

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