Difference between 'YYYY' and 'yyyy' in NSDateFormatter

后端 未结 4 544
北恋
北恋 2020-11-22 15:43

What is exact difference between \'YYYY\' and \'yyyy\'. I read in this link, it states that

A common mistake is to use YYYY. yyyy specifies the calen

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 16:06

    A common mistake is to use YYYY. yyyy 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.

    from Apple Docs

提交回复
热议问题