Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import android.annotation.SuppressLint; public class Main { @SuppressLint("SimpleDateFormat") public static long time2Mills(String time) { SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return sdf2.parse(time).getTime(); } catch (ParseException e) { e.printStackTrace(); } return System.currentTimeMillis(); } }