Here you can find the source of stringTolong(String time)
public static long stringTolong(String time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long stringTolong(String time) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dt2;/*from w ww . j a va 2s .c om*/ long lTime = 0; try { if (time != null && !time.equals("")) { dt2 = sdf.parse(time); lTime = dt2.getTime(); } else { return lTime; } } catch (ParseException e) { e.printStackTrace(); } return lTime; } }