ParseDate

try {
    // Some examples
    DateFormat formatter = new SimpleDateFormat("MM/dd/yy");
    Date date = (Date)formatter.parse("01/29/02");

    formatter = new SimpleDateFormat("dd-MMM-yy");
    date = (Date)formatter.parse("29-Jan-02");

    // Parse a date and time; see also
    // Parsing the Time Using a Custom Format
    formatter = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
    date = (Date)formatter.parse("2002.01.29.08.36.33");

    formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
    date = (Date)formatter.parse("Tue, 29 Jan 2002 22:14:02 -0500");
} catch (ParseException e) {
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.