Java tutorial
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import android.os.SystemClock; public class Main { public static long getTime(String dateString) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date date = formatter.parse(dateString); return date.getTime(); } catch (ParseException e) { e.printStackTrace(); } return SystemClock.elapsedRealtime(); } }