JAVA study notes the Clendar

    C = Calendar.getInstance Calendar ();
// YEAR years
// MONTH month, start counting from 0, maximum 11; 0 for January, 11 representatives of 12 months.
// DATE days
// when HOUR
// MINUTE minutes
// SECOND seconds
// int year = c.get (Calendar.YEAR);
// int = month The c.get (the Calendar.MONTH);
        // the target date calendar object into
        a date c.getTime = dATE ();
        DateFormat df = new new SimpleDateFormat ( "yyyy Year MM month dd day");
        String str = df.format (dATE);
        System.out.println ( "today the date is: "+ str);
        calBirthday ();
        

    }
    
    Public static void calBirthday () {
        Calendar Calendar.getInstance My = ();
        Calendar Calendar.getInstance C = ();
        // set the date
        my.set (Calendar.YEAR, 2020);
        my.set (the Calendar.MONTH , 0);
        my.set (Calendar.DATE,. 1);
        
        // get the number of days in the
        int day = c.get (Calendar.DATE);
        int = MyDay my.get (Calendar.DATE);
        int = a MyDay -day;
        System.out.println (A);
    }

Guess you like

Origin blog.csdn.net/lieanwan2780/article/details/88526343
Recommended