Weird behavior when creating an NSDate of January the 1st and the 2nd

后端 未结 1 757
栀梦
栀梦 2021-01-23 11:59

I\'m creating a date like this :

NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];

NSDateFormatter *dateFormatter = [         


        
相关标签:
1条回答
  • 2021-01-23 12:05

    See the Unicode standard. "yyyy" (lower case) gives you the year, but "YYYY" (upper case) gives you the year for the date's week (that is, if the date is within the 52nd week of the last year, YYYY will be last year).

    0 讨论(0)
提交回复
热议问题