Recently made a silly mistake, formatted month and day when accidentally yyyy-mm-dd written yyyy-mm-dd, resulting in the formatting results of middle-aged is not correct. Look at the answer to the question: http://www.zhihu.com/question/23730083 One of the answers: Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Ma Xiaoming
Links: http://www.zhihu.com/question/23730083/answer/25475256
Source: Know
YYYY-MM-DD HH:mm:ss
Year-month-day time: minutes: seconds
Uppercase is to differentiate between "
Monthand
points”
By the way HH why capitalization is to differentiate
12-hour systemAnd
24-hour system。
The lowercase h is a 12-hour system, and the uppercase H is a 24-hour system.
Written format and language provisions, the above-mentioned wording is the Windows system of our common wording, including the date set in the Office software. There are similar but different ways of using symbols or formats in other languages.
There are times when we see this format: yyyy-m-d h:m:s
MM and M, the difference is
is there a leading 0: H,m,s says
non-zero start, Hh,mm,ss said
Start from scratch。
For example, 1:2 A.M., hh:mm is displayed as
01:02, the h:m is displayed as
1:2。
Take January 1, 2014 1:1 A.M. 1 seconds (the same day is Wednesday) for an example to introduce the other:
yyyy/yyy/yy/yDisplayed as
2014/2014/14/4
(3 y and 4 y are the same, write 4 y for ease of understanding)
mmmm/mmm/mm/mDisplayed as
January/January/01/1
(4 m display full name, 3 m display abbreviation, but Chinese display is the same, English is January and Jan)
dddd/ddd/dd/dDisplayed as
Wednesday/Wednesday(Some languages are displayed as "three")
/01/1
(in English, like M, 4 D is the full name, 3 is the abbreviation;
DDDD/DDD for the day of the week, dd/d to indicate the date)
hh/h/hh/hDisplayed as
01/1/01 AM/1 AM
The rest.
mm/m/ss/sIt's just a matter of leading zeros.
YYYY/M/D/DDDD H:mm:ss is January 1, 2014 Wednesday 1:01:01
[Go] date format (YYYY-MM-DD), why is M multiple uppercase?