这个时间戳本来是2015-12-27但是打印出来是2016-12-27
时间戳:1451145600
[formatter setDateFormat:@"YYYY-MM-dd"]; NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"]; [formatter setTimeZone:timeZone]; [formatter stringFromDate:endDate]
光阴似箭催人老,日月如移越少年。
형식 문자열에 대문자 YYYY 대신 소문자 yyyy를 사용해야 합니다. 대문자 YYYY는 연도를 ISO 주간 달력의 연도 형식으로 지정합니다. 이는 대부분 동일하지만 연초의 끝과 시작 날짜는 다를 수 있습니다. 자세한 내용은 Wikipedia를 참조하세요.
참조: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html#//apple_ref/doc/uid/TP40002369-SW4
형식 문자열에 대문자 YYYY 대신 소문자 yyyy를 사용해야 합니다. 대문자 YYYY는 연도를 ISO 주간 달력의 연도 형식으로 지정합니다. 이는 대부분 동일하지만 연초의 끝과 시작 날짜는 다를 수 있습니다. 자세한 내용은 Wikipedia를 참조하세요.
으아악참조: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html#//apple_ref/doc/uid/TP40002369-SW4