Java Date Date, the number of days of the year, the abbreviation of the week, how many days of the month, how many months

Source: Internet
Author: User
Tags locale


import java.util. *;
  
public class DateDemo {
   public static void main (String args []) {
       Date date = new Date ();
        // b use, short for month
        String str = String.format (Locale.US, "English month abbreviation:% tb", date);
        System.out.println (str);
        System.out.printf ("Local month abbreviation:% tb% n", date);
        // The use of B, the full name of the month
        str = String.format (Locale.US, "English month full name:% tB", date);
        System.out.println (str);
        System.out.printf ("The full name of the local month:% tB% n", date);
        // a use, week abbreviation
        str = String.format (Locale.US, "Abbreviation for English week:% ta", date);
        System.out.println (str);
        // A use, full name
        System.out.printf ("short for local week:% tA% n", date);
        // The use of C, the first two digits
        System.out.printf ("First two digits of the year (less than two digits followed by 0):% tC% n", date);
        // y is used, two digits after the year
        System.out.printf ("The last two digits of the year (less than two digits followed by 0):% ty% n", date);
        // The use of j, the number of days in a year
        System.out.printf ("Days of the year (ie days of the year):% tj% n", date);
        // m usage, month
        System.out.printf ("Two-digit month (less than two digits followed by 0):% tm% n", date);
        // d use, day (two digits, not enough to zero)
        System.out.printf ("Two-digit day (less than two digits followed by 0):% td% n", date);
        // e's use, day (one digit is not padded)
        System.out.printf ("Day of the month (without zeros):% te", date);
   }
}
English Month Abbreviation: May
Local month abbreviation: May
English Month Full Name: May
Local month full name: May
English abbreviation for week: Thu
Abbreviation for local week: Thursday
The first two digits of the year (less than two digits followed by 0): 20
Last two digits of the year (less than two digits followed by 0): 17
Days of the year (ie days of the year): 124
Two-digit month (less than two digits followed by 0): 05
Two-digit day (less than two digits followed by 0): 04
Day of the month (not preceded by 0): 4 





Java Date Date, the number of days of the year, the abbreviation of the week, how many days of the month, how many months


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.