Here you can find the source of getTimeStampInSecond(String timeStr)
public static long getTimeStampInSecond(String timeStr)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static long getTimeStampInSecond(String timeStr) { SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try {/*ww w. ja va2 s . c om*/ return timeFormat.parse(timeStr).getTime() / 1000; } catch (ParseException e) { e.printStackTrace(); return -1; } } }