Java SQL Date Create convertToSQLDate(java.util.Date date)

Here you can find the source of convertToSQLDate(java.util.Date date)

Description

convert To SQL Date

License

Open Source License

Declaration

public static final java.sql.Date convertToSQLDate(java.util.Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

public class Main {
    private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat(
            "yyyy-MM-dd");

    public static final java.sql.Date convertToSQLDate(java.util.Date date) {
        if (date != null) {
            String formated = DATEFORMAT.format(date);
            return java.sql.Date.valueOf(formated);
        }//w ww.j a  va 2  s  .c o  m

        return null;
    }
}

Related

  1. convertToMySqlDate(Date date)
  2. convertToSDate(java.util.Date uDate)
  3. convertToSqlDate(Calendar calendar)
  4. convertToSqlDate(java.util.Date argUtilDate)
  5. ConvertToSqlDate(java.util.Date date)
  6. convertToSqlDate(java.util.Date utilDate)
  7. convertToSqlDate(String str)
  8. convertToUDate(String dateInString)
  9. createDate(int day, int month, int year)