Based on. Number and date formatting rules in net use details _ practical skills for memorizing words

Source: Internet
Author: User
Tags lowercase month name

Formatting can be done by using string. The format method is executed directly or by using the Xx.tostring ("") method. Formatting rules are not too good to remember, this article through Simple CI, can help you remember these rules
1. Number format
The rules are simple. The type of the format can be optionally followed by a number to indicate the number of decimal places to retain.
The letters are just a few: C, D, E, F, G, N, P, R, X case is universal

2. DateTime format
2013-05-18 13:09:24.211 +8:00
Year is Y:
One Y-year single-digit
YY year after two digits
Three digits after yyy year
YYYY four-bit year
YYYYY four-digit year before plus 0

Large m table month, less than 10 without leading 0
MM table month, less than October to add a leading 0
Three m month name, to be remembered in short order
Four m month name, to use the full name can not forget

A d indicates the number, No. 0 before 10th.
DD says it's a number, plus 0 before 10th.
DDD means the day of the week, the name is abbreviated to remember
Dddd said the day of the week, to use the full name can not forget

Lowercase h table hours, 12 can not be forgotten
An h cannot be preceded by 0, two h if necessary leading 0
Size h table hour, 24 into the system to remember
An h cannot be preceded by 0, two h if necessary leading 0

lowercase m table minutes, one without leading 0, two if necessary leading 0
Lowercase s represents seconds, one without leading 0, two if necessary leading 0

F means one-tenth seconds
FF represents percent of seconds
FFF represents the number of milliseconds
FFFF represents very one of the milliseconds
The analogy to 7f
Uppercase lowercase has a difference
If it is 0, uppercase ignores lowercase has

There are two other less common
GG means on the afternoon
K, z means the time zone

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.