stringFromDate returning the wrong year

前端 未结 1 459
耶瑟儿~
耶瑟儿~ 2020-12-07 02:55
#define stdDateFormat @\"YYYYMMdd\'T\'hh:mm:ssZ\"
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:stdDateFormat];
NSString *Ti         


        
相关标签:
1条回答
  • 2020-12-07 04:01

    Use lowercase yyyy for the year instead of YYYY.

    Uppercase Y means the year of the start of the week the date is in (Jan 3, 2009 is in a week that starts in 2008).

    See Unicode Date Format Patterns.

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