Here you can find the source of convertDateStringToLong(String date, String format)
public static long convertDateStringToLong(String date, String format)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static long convertDateStringToLong(String date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); long time = -1; try {/*from ww w . j a va2 s . c o m*/ time = sdf.parse(date).getTime(); } catch (ParseException e) { e.printStackTrace(); } return time; } }