Java SQL Date Parse strToDate(String value, String pattern)

Here you can find the source of strToDate(String value, String pattern)

Description

str To Date

License

Apache License

Declaration

public static java.sql.Date strToDate(String value, String pattern) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static java.sql.Date strToDate(String value, String pattern) {
        if (value.length() <= 10)
            value = value + " 00:00:00";
        java.text.SimpleDateFormat format = new java.text.SimpleDateFormat(pattern);
        java.text.ParsePosition pos = new java.text.ParsePosition(0);
        return new java.sql.Date(format.parse(value, pos).getTime());
    }/*from   w  w  w. j  a v  a 2s.c o m*/
}

Related

  1. StrToDate(String Formate, String date)
  2. strToDate(String str)
  3. strToDate(String strDate, String formator)
  4. strToDate(String stringDate)
  5. StrToDate(String val)
  6. strToSqlDate(String format, String value)
  7. strToUtilDate(String fecha, String hora)