Convert java.util.Date Object to a java.sql.Date Object


Following class can use for conversion.


public class UtilToSql {

  public static void main(String[] args) {
 
    java.util.Date utilDate = new java.util.Date();
    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
    System.out.println("Util Date :" + utilDate);
    System.out.println("Sql Date:" + sqlDate);
 
  }

}

Result:


Util Date :Tue Sep 11 07:30:48 CDT 2012
Sql Date:2012-09-11

3 comments:

  1. Students can see the move comment without seeing the comming moves forcing them to think about the position before seeing the answer. online school management systems

    ReplyDelete
  2. You can create your own diagram showing the industries and flows that you select, in any order you choose.best virtual assistant

    ReplyDelete