String format the current date

Source: Internet
Author: User
Import java. util. date;
Import java. util. locale;
Public class example {
Public static void main (string [] ARGs)
{
Date today = new date ();
String A = string. Format (locale. Us, "% TB", today); // The formatted string is the abbreviation of the month.
System. Out. println ("the formatted string is the abbreviation of the month:" + );
String B = string. Format (locale. Us, "% TB", today); // The formatted string is the English full write of the month.
System. Out. println ("formatted strings are all written in English" + B );
String c = string. Format ("% ta", today); // The formatted string is a week (such as Monday)
System. Out. println ("the month formatted string is week:" + C );
String d = string. Format ("% ta", today); // The formatted string is a week (such as Tuesday)
System. Out. println ("the formatted string is week:" + D );
String E = string. Format ("% ty", today); // The formatted string is a four-digit year value.
System. Out. println ("the formatted string is a four-digit year value" + E );
String F = string. Format ("% ty", today); // The formatted year is a two-digit year value.
System. Out. println ("the formatted year is a two-digit year value" + F );
String G = string. Format ("% TM", today); // The formatted string is a two-digit month value.
System. Out. println ("formatted string is a two-digit month value" + G );
String H = string. Format ("% TD", today); // The formatted string contains two date values.
System. Out. println ("formatted string is a two-digit date value" + H );
String I = string. Format ("% te", today); // The formatted string is a one-bit string.
System. Out. println ("the formatted string is a one-bit date value" + I );
}
} Import java. util. date;
Import java. util. locale;
Public class example {
Public static void main (string [] ARGs)
{
Date today = new date ();
String A = string. Format (locale. Us, "% TB", today); // The formatted string is the abbreviation of the month.
System. Out. println ("the formatted string is the abbreviation of the month:" + );
String B = string. Format (locale. Us, "% TB", today); // The formatted string is the English full write of the month.
System. Out. println ("formatted strings are all written in English" + B );
String c = string. Format ("% ta", today); // The formatted string is a week (such as Monday)
System. Out. println ("the month formatted string is week:" + C );
String d = string. Format ("% ta", today); // The formatted string is a week (such as Tuesday)
System. Out. println ("the formatted string is week:" + D );
String E = string. Format ("% ty", today); // The formatted string is a four-digit year value.
System. Out. println ("the formatted string is a four-digit year value" + E );
String F = string. Format ("% ty", today); // The formatted year is a two-digit year value.
System. Out. println ("the formatted year is a two-digit year value" + F );
String G = string. Format ("% TM", today); // The formatted string is a two-digit month value.
System. Out. println ("formatted string is a two-digit month value" + G );
String H = string. Format ("% TD", today); // The formatted string contains two date values.
System. Out. println ("formatted string is a two-digit date value" + H );
String I = string. Format ("% te", today); // The formatted string is a one-bit string.
System. Out. println ("the formatted string is a one-bit date value" + I );
}
}

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.