Here you can find the source of DateToTimestamp(Date time)
public static Integer DateToTimestamp(Date time)
//package com.java2s; import java.sql.Timestamp; import java.util.Date; public class Main { public static Integer DateToTimestamp(Date time) { Timestamp ts = new Timestamp(time.getTime()); return (int) ((ts.getTime()) / 1000); }//w w w.ja v a2s .c o m }