Java Parse Date parseDate(String dateStr)

Here you can find the source of parseDate(String dateStr)

Description

parse Date

License

Open Source License

Declaration

public static Date parseDate(String dateStr) throws ParseException 

Method Source Code


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

import java.text.ParseException;
import java.util.Date;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;

public class Main {
    public static final String DEFAULT_DATE_PATTERN = "YYYY-MM-dd HH:mm:ss";

    public static Date parseDate(String dateStr) throws ParseException {
        return parseDate(dateStr, DEFAULT_DATE_PATTERN);
    }/*from w  w  w . j a va2  s .c o  m*/

    public static Date parseDate(String dateStr, String datePattern) throws ParseException {
        DateTime dt = DateTimeFormat.forPattern(datePattern).parseDateTime(dateStr);
        return dt.toDate();
    }
}

Related

  1. parseDate(String dateAsString)
  2. parseDate(String dateAsString)
  3. parseDate(String dateFormat, String value)
  4. parseDate(String dateOfString, String targetFormat)
  5. parseDate(String datestr)
  6. parseDate(String dateStr)
  7. parseDate(String dateStr)
  8. parseDate(String dateStr)
  9. parseDate(String dateStr)