Java tutorial
//package com.java2s; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long dateStrToLong(String strDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(strDate, pos); return strtodate.getTime(); } }