Here you can find the source of getTodayLastSecond()
public static Date getTodayLastSecond()
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static Date getTodayLastSecond() { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH); calendar.set(year, month, day, 23, 59, 59); return calendar.getTime(); }//from w w w . j av a 2 s . com public static String getTodayLastSecond(String format) { return getFormat(format).format(getTodayLastSecond()); } public static final String format(Date date, String formate) { if (date == null) { return ""; } return getFormat(formate).format(date); } public static final String format(Long dateTmie, String formate) { Date date = new Date(dateTmie); return getFormat(formate).format(date); } public static final DateFormat getFormat(String format) { return new SimpleDateFormat(format); } }