Detailed explanation and code example of simpledateformat date format conversion in Java

Simpledateformat is a class that handles date format conversion.

Official API_ 1.8 screenshot of simpledateformat inherited from dateformat:

The constructor of simpledateformat is as follows:

The format definitions in simpledateformat are circled in red:

Chinese Interpretation:

Y: year M: month in the year D: days in the year D: days in the month W: weeks in the year W: weeks in the month a: up and down / afternoon H: hours in a day (0-23) H: hours in a day (0-12) M: minutes in hours s: seconds in minutes s: milliseconds

Simpledateformat method:

Methods inherited from dateformat:

Simpledateformat common methods and common format definitions usage examples:

Program running results:

summary

For simpledateformat, you need to be able to use common methods under different parameters, common formats and constructor abbreviations.

The above is the whole content of this article. I hope it will be helpful to you. Interested friends can continue to refer to other related topics on this site. If there are deficiencies, please leave a message to point out. Thank you for your support!

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
分享
二维码
< <上一篇
下一篇>>