Here you can find the source of parseDate(String date)
Parameter | Description |
---|---|
date | string date |
public static Date parseDate(String date)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**// w w w .j a va 2s . c o m * default date format pattern */ public final static String DATE_FORMAT = "yyyy-MM-dd"; /** * parse date with the default pattern * * @param date string date * @return the parsed date */ public static Date parseDate(String date) { SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); try { return format.parse(date); } catch (ParseException e) { return new Date(); } } public static Date parseDate(String date, String pattern) { SimpleDateFormat format = new SimpleDateFormat(pattern); try { return format.parse(date); } catch (ParseException e) { return new Date(); } } }