Java String to Date toDate(String str)

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

Description

to Date

License

Apache License

Declaration

public static Date toDate(String str) throws ParseException 

Method Source Code


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

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

public class Main {

    public static Date toDate(String str) throws ParseException {
        DateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        return format.parse(str);
    }/*from  w  ww.  j  a  va  2 s.c  o  m*/

    public static Date toDate(String str, String style) throws ParseException {
        DateFormat format = new SimpleDateFormat(style);
        return format.parse(str);
    }
}

Related

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