Java SQL Date Parse strToDate(String stringDate)

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

Description

str To Date

License

Open Source License

Declaration

public static Timestamp strToDate(String stringDate)
            throws ParseException 

Method Source Code

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

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    public static Timestamp strToDate(String stringDate)
            throws ParseException {

        SimpleDateFormat formatter = new SimpleDateFormat(
                "yyyy-MM-dd'T'hh:mm:ss");
        //2015-07-03T12:52:29.000Z
        if (stringDate != null) {
            java.util.Date dateResult = formatter.parse(stringDate);
            return new Timestamp(dateResult.getTime());
        }/*from ww w .  j  a  v  a2  s.com*/
        return null;
    }
}

Related

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