Here you can find the source of parseTime(String date, String format)
public static Date parseTime(String date, String format)
//package com.java2s; //License from project: LGPL import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String DEFAULT_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static Date parseTime(String date, String format) { if (date == null) { return null; }/*from w ww . j a v a 2 s . c o m*/ try { return new SimpleDateFormat(format).parse(date); } catch (ParseException e) { throw new RuntimeException(e); } } public static Date parseTime(String date) { return parseTime(date, DEFAULT_TIME_FORMAT); } }