@@ -0,0 +1,796 @@
+package test.netty.discard;%0A%0Aimport java.util.Calendar;%0Aimport java.util.Date;%0A%0A/**%0A * User: gais.ch%0A * Date: 15-5-4%0A * Time: %E4%B8%8A%E5%8D%8811:10%0A */%0Apublic class Main %7B%0A    public static void main(String%5B%5D args) %7B%0A        Date date = new Date();%0A        System.out.println((int) (getDayEnd(date) - date.getTime() / 1000));%0A    %7D%0A%0A    /**%0A     * %E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%B6%E9%97%B4%E7%9A%84%E5%BD%93%E5%A4%A9%E7%BB%93%E6%9D%9F%E6%97%B6%E9%97%B4%0A     *%0A     * @param date%0A     * @return%0A     */%0A    public static long getDayEnd(Date date) %7B%0A        Calendar calendar = Calendar.getInstance();%0A        calendar.setTime(date);%0A        calendar.set(Calendar.HOUR_OF_DAY, 0);%0A        calendar.set(Calendar.MINUTE, 0);%0A        calendar.set(Calendar.SECOND, 0);%0A        calendar.set(Calendar.MILLISECOND, 0);%0A        calendar.add(Calendar.DATE, 1);%0A        return calendar.getTimeInMillis();%0A    %7D%0A%7D%0A

add test data