Here you can find the source of getDate(String sDate, String dateFormat)
public static Date getDate(String sDate, String dateFormat)
//package com.java2s; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date getDate(String sDate, String dateFormat) { SimpleDateFormat fmt = new SimpleDateFormat(dateFormat); ParsePosition pos = new ParsePosition(0); return fmt.parse(sDate, pos); }/*from ww w . jav a 2 s .co m*/ public static Date getDate(int year, int month, int date, int hourOfDay, int minute, int second) { Calendar cal = new GregorianCalendar(); cal.set(year, month, date, hourOfDay, minute, second); return cal.getTime(); } }