Java SQL Date Create convertDateFromUtilToSql(java.util.Date utilDate)

Here you can find the source of convertDateFromUtilToSql(java.util.Date utilDate)

Description

convert Date From Util To Sql

License

Open Source License

Declaration

static java.sql.Date convertDateFromUtilToSql(java.util.Date utilDate) 

Method Source Code

//package com.java2s;

public class Main {
    static java.sql.Date convertDateFromUtilToSql(java.util.Date utilDate) {
        java.sql.Date sqlDate = null;
        if (utilDate != null) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(utilDate);/*from   w  w  w .j a v  a  2  s.c  om*/
            cal.set(Calendar.HOUR_OF_DAY, 0);
            cal.set(Calendar.MINUTE, 0);
            cal.set(Calendar.SECOND, 0);
            cal.set(Calendar.MILLISECOND, 0);
            sqlDate = new java.sql.Date(cal.getTimeInMillis());
        }
        return sqlDate;
    }
}

Related

  1. convert(Date date)
  2. convertDate(java.sql.Date date)
  3. convertDateFromSQLDate(java.sql.Date sqlDate)
  4. convertDateFromSqlToUtil(java.sql.Date sqlDate)
  5. convertDateFromString(String inputDateString)
  6. convertDateIfNecessary(Date date)
  7. convertDateToString(java.sql.Date argDate)
  8. convertFormat(java.sql.Date dt, String formatter)
  9. convertFormat(String dateData)