Java SQL Date Parse strToDate(String str)

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

Description

str To Date

License

Apache License

Declaration

public static Date strToDate(String str) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date strToDate(String str) {

        Date date = null;/*from  ww  w. j  a va  2s  .  co  m*/
        try {
            // date = java.sql.Date.valueOf(str);
            SimpleDateFormat sdate = new SimpleDateFormat("yyyy-MM-dd");
            date = (Date) sdate.parse(str);
        } catch (Exception e) {
            e.getStackTrace();
        }
        return date;
    }
}

Related

  1. stringToSqlDate(String date)
  2. stringToSqlDate(String dateVal)
  3. stringToSQLDate(String pstrValue, String pstrDateFormat)
  4. stringToSqlDate(String str)
  5. StrToDate(String Formate, String date)
  6. strToDate(String strDate, String formator)
  7. strToDate(String stringDate)
  8. StrToDate(String val)
  9. strToDate(String value, String pattern)