Java Parse Date Pattern YYYY parse(String date)

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

Description

parse

License

Apache License

Declaration

public static Date parse(String date) 

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;
import java.util.Locale;
import java.util.TimeZone;

public class Main {
    /**/*from   ww  w.  j  a  v a  2 s  . c o  m*/
     * RFC822 5. DATE AND TIME SPECIFICATION
     */
    static final String RFC1123_DATEFORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
    static final TimeZone GMT = TimeZone.getTimeZone("GMT");

    public static Date parse(String date) {
        try {
            DateFormat fmt = newGMTFormatter();
            return fmt.parse(date);
        } catch (ParseException e) {
            throw new IllegalArgumentException(date);
        }
    }

    public static DateFormat newGMTFormatter() {
        SimpleDateFormat fmt = new SimpleDateFormat(RFC1123_DATEFORMAT, Locale.ENGLISH);
        fmt.setTimeZone(GMT);
        return fmt;
    }
}

Related

  1. parse(String d)
  2. parse(String date)
  3. parse(String date)
  4. parse(String date)
  5. parse(String date)
  6. parse(String date)
  7. parse(String date)
  8. parse(String date)
  9. parse(String date)