Here you can find the source of parseDate(String s)
Parameter | Description |
---|---|
s | the text |
Parameter | Description |
---|---|
ParseException | an exception |
static public Date parseDate(String s) throws ParseException
//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 av a 2 s. co m*/ * format pattern : yyyy-MM-dd */ public static final SimpleDateFormat FORMAT_YYYY_MM_DD = new SimpleDateFormat("yyyy-MM-dd"); /** * Parses text in 'YYYY-MM-DD' format to produce a date. * * @param s * the text * @return Date * @throws ParseException */ static public Date parseDate(String s) throws ParseException { return FORMAT_YYYY_MM_DD.parse(s); } static public Date parseDate(String s, String f) throws ParseException { SimpleDateFormat format = new SimpleDateFormat(f); return format.parse(s); } }