Java tutorial
//package com.java2s; import android.content.Context; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDateWithDefaultFormat(Context context, String strDate) throws ParseException { return getDate("yyyy/MM/dd", strDate); } public static Date getDate(String format, String strDate) throws ParseException { DateFormat dateFormat = new SimpleDateFormat(format); Date date = dateFormat.parse(strDate); return date; } }