Here you can find the source of parseDate(String s, String format)
Parameter | Description |
---|---|
s | the string to parse |
format | the date format |
public static Date parseDate(String s, String format)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from ww w. j av a 2 s . c o m * Utility method to parse a date in the given format * @param s the string to parse * @param format the date format * @return a Date representing the date in the passed format */ public static Date parseDate(String s, String format) { DateFormat df = new SimpleDateFormat(format); try { return df.parse(s); } catch (Exception e) { throw new RuntimeException("Cannot parse " + s + " into a date using format " + format); } } }