Here you can find the source of timeToLong(Object timeObj)
public static long timeToLong(Object timeObj)
//package com.java2s; import java.sql.Timestamp; import java.util.Date; public class Main { public static long timeToLong(Object timeObj) { long returnVal = 0; if (timeObj instanceof Timestamp) { returnVal = ((Timestamp) timeObj).getTime(); } else if (timeObj instanceof Date) { returnVal = ((Date) timeObj).getTime(); }//from w w w . j a v a 2 s. c o m return returnVal; } }