Java Parse Date parseDate(String dateString)

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

Description

parse Date

License

Open Source License

Declaration

public static Date parseDate(String dateString) 

Method Source Code

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

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

import java.util.Locale;
import java.util.TimeZone;

public class Main {
    private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
    private static final String DATE_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";

    public static Date parseDate(String dateString) {
        if (dateString == null) {
            return null;
        }//from   w ww. j  a v  a 2s.co  m

        SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN, Locale.US);
        format.setTimeZone(GMT);
        try {
            return format.parse(dateString);
        } catch (ParseException ignore) {
        }
        return null;
    }
}

Related

  1. parseDate(String dateString)
  2. parseDate(String dateString)
  3. parseDate(String dateString)
  4. parseDate(String dateString)
  5. parseDate(String dateString)
  6. parseDate(String dateString)
  7. parseDate(String dateString, Locale locale)
  8. parseDate(String dateString, SimpleDateFormat simpleDateFormat)
  9. parseDate(String dateString, String dateFormat)