1. 程式人生 > >日期格式獲取當天的最大日期

日期格式獲取當天的最大日期

AI gre date() span AR ring static nth sys

public static void main(String[] args) {
        Calendar c1 = new GregorianCalendar();
        c1.set(Calendar.HOUR_OF_DAY, 0);
        c1.set(Calendar.MINUTE, 0);
        c1.set(Calendar.SECOND, 0);
        System.out.println(c1.getTime().toLocaleString());
        Calendar c2 = new GregorianCalendar();
        c2.set(Calendar.HOUR_OF_DAY, 
23); c2.set(Calendar.MINUTE, 59); c2.set(Calendar.SECOND, 59); System.out.println(c2.getTime().toLocaleString()); /*Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); Date start = calendar.getTime(); calendar.add(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.SECOND, -1); Date end = calendar.getTime(); System.out.println(start); System.out.println(end);
*/ }

嗯,先記錄一個

日期格式獲取當天的最大日期