Here you can find the source of getTimestampFromDate(String d)
public static long getTimestampFromDate(String d)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { static final DateFormat DATE_NAME_FORMAT = new SimpleDateFormat("yyyy/MM/dd"); public static long getTimestampFromDate(String d) { try {/*from ww w.j av a 2 s . co m*/ return DATE_NAME_FORMAT.parse(d).getTime(); } catch (ParseException e) { System.err.println(d + " getTimestampFromDate " + e.getMessage()); } return 0; } public static int getTimestampFromDate(java.sql.Date d) { if (d != null) { return (int) (d.getTime() / 1000); } return 0; } }