Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import android.annotation.SuppressLint; public class Main { @SuppressLint("SimpleDateFormat") public static Date StringToDate(String str) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); Date date = null; try { date = sdf.parse(str); } catch (java.text.ParseException e) { e.printStackTrace(); } return date; } }