Java Parse Date parseDate(String date)

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

Description

parse Date

License

Open Source License

Declaration

public synchronized static Date parseDate(String date) 

Method Source Code

//package com.java2s;

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

import java.util.Date;

public class Main {
    public static final DateFormat DEFAULT_DATETIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static Date parseDate(String date, DateFormat df) {
        try {/*from w  ww. j  av  a 2 s  .c o  m*/
            return df.parse(date);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }

    public static Date parseDate(String date, String dateFormat) {
        SimpleDateFormat fmt = new SimpleDateFormat(dateFormat);
        return parseDate(date, fmt);
    }

    public synchronized static Date parseDate(String date) {
        return parseDate(date, DEFAULT_DATETIME_FORMAT);
    }
}

Related

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