Here you can find the source of parseDateTime(String currDate, String format)
public static Date parseDateTime(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 parseDateTime(String currDate, String format) { SimpleDateFormat dtFormatdB = null; try {/*from w w w .ja v a 2s .c o m*/ dtFormatdB = new SimpleDateFormat(format); return dtFormatdB.parse(currDate); } catch (Exception e) { dtFormatdB = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return dtFormatdB.parse(currDate); } catch (Exception ex) { } } return null; } }