Here you can find the source of parseTime(String currDate, String format)
public static Date parseTime(String currDate, String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date parseTime(String currDate, String format) { SimpleDateFormat dtFormatdB = null; try {//from w w w. ja va 2s .c o m dtFormatdB = new SimpleDateFormat(format); return dtFormatdB.parse(currDate); } catch (Exception e) { dtFormatdB = new SimpleDateFormat("HH:mm:ss"); try { return dtFormatdB.parse(currDate); } catch (Exception ex) { } } return null; } }