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

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.