日期格式 YYYY-MM-dd 和 yyyy-MM-dd 有什么区别?

 

NSDateFormatter

 

“YYYY format” 是 “ISO week numbering system”
“yyyy format” 是 “Gregorian Calendar”

 

There are two things to note about this example:

  1. It uses yyyy to specify the year component. A common mistake is to use YYYYyyyy specifies the calendar year whereas YYYY specifies the year (of “Week of Year”), used in the ISO year-week calendar. In most cases, yyyy and YYYY yield the same number, however they may be different. Typically you should use the calendar year.
  2. The representation of the time may be 13:00. In iOS, however, if the user has switched 24-Hour Time to Off, the time may be 1:00 pm.

例如:2013-12-31 这一天

yyyy-MM-dd   2013-12-31

YYYY-MM-dd   2014-12-31

 

 

发表评论

*

* 绝不会泄露


Design By Inzaghi | 京ICP备16047555号-1