Java Date, the day of the year, the abbreviation of the week, the number of days of the month, the number of months of the year, javadate
Import java. util. *; public class DateDemo {public static void main (String args []) {Date date = new Date (); // use of B, month abbreviation String str = String. format (Locale. US, "abbreviated month: % tb", date); System. out. println (str); System. out. printf ("Local month Abbreviation: % tb % n", date); // use of B, full name of month str = String. format (Locale. US, "Full name of English month: % tB", date); System. out. println (str); System. out. printf ("Local month full name: % tB % n", date); // Use of a, str = String for weeks. format (Locale. US, "% ta", date); System. out. println (str); // Use of A, the full name of the week is System. out. printf ("Local week Abbreviation: % tA % n", date); // C usage, two systems a year ago. out. printf ("the first two digits of the Year (less than two digits of the first digit fill 0): % tC % n", date); // use of y, two systems after the year. out. printf ("the last two digits of the Year (less than two digits are preceded by 0): % ty % n", date); // j, the number of days of the year System. out. printf ("days in a year (that is, the day of the year): % tj % n", date); // use of m, month System. out. printf ("two-digit month (less than two first 0): % tm % n", date); // use of d, Day (two, Less Than Zero) System. out. printf ("two-digit Day (less than two first 0): % td % n", date); // use of e, day (one digit is not zero) System. out. printf ("day of the month (0 is not added before): % te", date );}}
Abbreviated Month: May local month Abbreviation: May English month full name: May local month full name: May English week Abbreviation: Thu local week Abbreviation: the first two digits of the Week (less than two digits plus 0): the last two digits of the 20 years (less than two digits plus 0): 17 days of the year (that is, the day of the year ): 124 double-digit month (0 for less than two digits): 05 double-digit Day (0 for less than two digits): day for January (0 for less than two digits): 4