Java String to Date toDate(String sDate, String sFmt)

Here you can find the source of toDate(String sDate, String sFmt)

Description

to Date

License

Open Source License

Declaration

public static Date toDate(String sDate, String sFmt) 

Method Source Code


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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

    public static Date toDate(String sDate, String sFmt) {
        Date dt = null;/*from   ww w  .j a v  a  2s  .c o  m*/
        try {
            dt = new SimpleDateFormat(sFmt).parse(sDate);
        } catch (ParseException e) {
            return dt;
        }
        return dt;
    }
}

Related

  1. toDate(String pString, String pFormat)
  2. toDate(String s)
  3. toDate(String s)
  4. toDate(String s, String format)
  5. toDate(String sdate, SimpleDateFormat dateFormater)
  6. toDate(String str)
  7. toDate(String str)
  8. toDate(String str)
  9. toDate(String strDate)