Java Parse Date parseDate(final String date, final String format)

Here you can find the source of parseDate(final String date, final String format)

Description

Parse string to date using given format.

License

Open Source License

Parameter

Parameter Description
date a parameter
format a parameter

Exception

Parameter Description
ParseException an exception

Return

Date

Declaration

public static Date parseDate(final String date, final String format)
        throws ParseException 

Method Source Code

//package com.java2s;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**//ww w  .j av  a 2 s . c o m
     * Parse string to date using given format.
     * 
     * @param date
     * @param format
     * @return Date
     * @throws ParseException
     */
    public static Date parseDate(final String date, final String format)
            throws ParseException {
        final SimpleDateFormat dfmt = new SimpleDateFormat(format);
        return dfmt.parse(date);
    }
}

Related

  1. parseDate(final String date)
  2. parseDate(final String date)
  3. parseDate(final String date)
  4. parseDate(final String date)
  5. parseDate(final String date, final List patterns)
  6. parseDate(final String dateStr)
  7. parseDate(final String dateString)
  8. parseDate(final String pDate)
  9. parseDate(final String revision)