Java SQL Date Create convertToSqlDate(String str)

Here you can find the source of convertToSqlDate(String str)

Description

convert To Sql Date

License

Open Source License

Declaration

public static java.sql.Date convertToSqlDate(String str) 

Method Source Code

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

import java.text.SimpleDateFormat;

public class Main {

    public static java.sql.Date convertToSqlDate(String str) {
        SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        java.sql.Date sqlDate = null;
        try {/*from  w w  w . j a va  2  s  .c  om*/
            java.util.Date date = bartDateFormat.parse(str);
            sqlDate = new java.sql.Date(date.getTime());
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
        return sqlDate;
    }
}

Related

  1. convertToSqlDate(Calendar calendar)
  2. convertToSqlDate(java.util.Date argUtilDate)
  3. convertToSQLDate(java.util.Date date)
  4. ConvertToSqlDate(java.util.Date date)
  5. convertToSqlDate(java.util.Date utilDate)
  6. convertToUDate(String dateInString)
  7. createDate(int day, int month, int year)
  8. createDateFormater(int dataType)
  9. createFutureDate(java.sql.Date lmpDate, int offSet)