Here you can find the source of parse(String dateString, String dateFormat)
public static Date parse(String dateString, String dateFormat)
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main{ public static Date parse(String dateString, String dateFormat) { if (StringUtil.isEmpty(dateString) || StringUtil.isEmpty(dateFormat)) { return null; }/*from w w w .jav a2 s. co m*/ SimpleDateFormat format = new SimpleDateFormat(dateFormat, Locale.ENGLISH); Date date = null; try { date = format.parse(dateString); } catch (Exception ex) { } return date; } }