Here you can find the source of parseDate(String dateString)
Parameter | Description |
---|---|
dateString | a parameter |
Parameter | Description |
---|---|
ParseException | an exception |
public static Date parseDate(String dateString) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** Field description */ public static final String DATE_PATTERN = "yyyy-MM-dd HH-mm-ss"; /**//from w w w . j a v a 2 s .c o m * Method description * * * @param dateString * @param tz * * @return * * @throws ParseException */ public static Date parseDate(String dateString, TimeZone tz) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); if (tz != null) { sdf.setTimeZone(tz); } return sdf.parse(dateString); } /** * Method description * * * @param dateString * * @return * * @throws ParseException */ public static Date parseDate(String dateString) throws ParseException { return parseDate(dateString, null); } }