Here you can find the source of toDate(String sDate, String sFmt)
public static Date toDate(String sDate, String sFmt)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date toDate(String sDate, String sFmt) { Date dt = null;/*from ww w .j a v a 2s .c o m*/ try { dt = new SimpleDateFormat(sFmt).parse(sDate); } catch (ParseException e) { return dt; } return dt; } }