Here you can find the source of ParseDate(String dateString)
Parameter | Description |
---|---|
dateString | String representation of a date |
public static Date ParseDate(String dateString)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.text.SimpleDateFormat; import java.util.*; public class Main { /** Parses a date object from a string representation. *//from w w w .j av a 2 s.c om * @param dateString String representation of a date * @return Date object */ public static Date ParseDate(String dateString) { return ParseDate(dateString, "MM/dd/yyyy"); } /** Parses a date object from a string representation using the specified date pattern. * * @param dateString String representation * @param datePattern Date pattern * @return Date object */ public static Date ParseDate(String dateString, String datePattern) { try { SimpleDateFormat fmt = new SimpleDateFormat(datePattern); return fmt.parse(dateString); } catch (Exception ex) { return null; } } }