Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static long getTimeInMills(String dateStr) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); Date date = sdf.parse(dateStr); return date.getTime(); } }