Java uses the string class to format the current date implementation code

When outputting date information, you often need to output date formats in different formats. This example introduces the date formatting method in string string class. The example outputs the date format parameter values of string class in different ways. Combining these values can realize the date string in special format.

The idea is as follows: for example, to output the English abbreviation of the month, through the format () method of the string class, the first parameter specifies the locale as locale Us, which is a number by default. The second parameter is% TB, indicating the abbreviation of the month, and the third parameter is a date () object.

The code is as follows:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>