Here you can find the source of convert2long(String date, String format)
public static long convert2long(String date, String format)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static long convert2long(String date, String format) { try {//from w ww. j a v a 2 s . c o m SimpleDateFormat sf = new SimpleDateFormat(format); return sf.parse(date).getTime(); } catch (ParseException e) { e.printStackTrace(); } return 0l; } }