Here you can find the source of stringConvertToTimestamp(String value, String format)
public static final int stringConvertToTimestamp(String value, String format)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final int stringConvertToTimestamp(String value, String format) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); Date date = null;//from ww w. j a v a2 s.c om try { date = simpleDateFormat.parse(value); } catch (ParseException e) { } return (int) (date.getTime() / 1000); } }