Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import android.annotation.SuppressLint; public class Main { @SuppressLint("SimpleDateFormat") public static Date toDate(String sDate, String sFmt) { SimpleDateFormat sdfFrom = null; java.util.Date dt = null; try { sdfFrom = new SimpleDateFormat(sFmt); dt = sdfFrom.parse(sDate); } catch (Exception ex) { return null; } finally { sdfFrom = null; } return dt; } }