Java Parse Date Pattern YYYY parse(String dateStr)

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

Description

parse

License

Apache License

Declaration

public static Date parse(String dateStr) 

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 final static String STANDARD_DATE_PATTERN = "yyyy-MM-dd";

    public static Date parse(String dateStr) {
        return parse(dateStr, STANDARD_DATE_PATTERN);
    }/* w  ww . j  av  a2 s. c o m*/

    public static Date parse(String dateStr, String pattern) {

        try {
            DateFormat format = new SimpleDateFormat(pattern);
            return format.parse(dateStr);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return null;
    }
}

Related

  1. parse(String date, String format)
  2. parse(String dateAsString)
  3. parse(String DateStr)
  4. parse(String dateStr)
  5. parse(String datestr)
  6. parse(String dateString)
  7. parse(String datestring)
  8. parse(String dateString)
  9. parse(String dateString)