Here you can find the source of formatStringTimeToLong(String timeLine)
public static long formatStringTimeToLong(String timeLine)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static final String FROMAT = "yyyy-MM-dd HH:mm:ss"; public static long formatStringTimeToLong(String timeLine) { long time = -1L; SimpleDateFormat format = new SimpleDateFormat(FROMAT); try {// w ww . j a va 2s .com time = format.parse(timeLine).getTime(); } catch (ParseException e) { e.printStackTrace(); } return time; } }