Java Parse Date parseDate(String dateString, String dateFormat)

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

Description

Parses the date from the given string, and the given format

License

GNU General Public License

Declaration

public static Date parseDate(String dateString, String dateFormat) throws ParseException 

Method Source Code

//package com.java2s;

import java.text.*;
import java.util.*;

public class Main {
    /**/*from   w  w w.  j av a  2  s. c  om*/
     * Parses the date from the given string, and the given format
     */
    public static Date parseDate(String dateString, String dateFormat) throws ParseException {
        Calendar cal = Calendar.getInstance();
        if (dateString != null)
            return new SimpleDateFormat(dateFormat).parse(dateString);
        throw new ParseException("Parse Exception manually thrown by parseDate(String, String)", 0);
    }
}

Related

  1. parseDate(String dateString)
  2. parseDate(String dateString)
  3. parseDate(String dateString)
  4. parseDate(String dateString, Locale locale)
  5. parseDate(String dateString, SimpleDateFormat simpleDateFormat)
  6. parseDate(String dateString, String format, TimeZone zone)
  7. parseDate(String dateString, String pattern)
  8. parseDate(String dateText)
  9. parseDate(String datetime)