Here you can find the source of string2long(String sourceTime, String dataFormat)
public static long string2long(String sourceTime, String dataFormat)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long string2long(String sourceTime, String dataFormat) { long longTime = 0L; DateFormat f = new SimpleDateFormat(dataFormat); Date d = null;//from w ww. j a v a 2 s . c om try { d = f.parse(sourceTime); } catch (ParseException e) { e.printStackTrace(); } if (null == d) longTime = 0; else longTime = d.getTime(); return longTime; } }