Java Parse Date parseDate(DateFormat f, String date)

Here you can find the source of parseDate(DateFormat f, String date)

Description

Parse date with formatter.

License

Open Source License

Parameter

Parameter Description
f formatter
date String date value

Exception

Parameter Description
RuntimeException if ParseException is thrown

Return

date

Declaration

public static Date parseDate(DateFormat f, String date) 

Method Source Code

//package com.java2s;

import java.text.DateFormat;
import java.text.ParseException;

import java.util.Date;

public class Main {
    /**//from   w  ww . j a v  a  2 s  .c o m
     * Parse date with formatter. 
     * 
     * @param f formatter
     * @param date String date value
     * @return date 
     * @throws RuntimeException if {@link ParseException} is thrown
     */
    public static Date parseDate(DateFormat f, String date) {
        try {
            return f.parse(date);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. parseDate(Date date)
  2. parseDate(Date date, int style, Locale local, boolean withTime)
  3. parseDate(Date date, String format)
  4. parseDate(Date date, String pattern)
  5. parseDate(DateFormat df, String dateStr)
  6. parseDate(final Date date)
  7. parseDate(final String date)
  8. parseDate(final String date)
  9. parseDate(final String date)