2013-01-16 61 views
1

我可以在我的應用程序中看到一個非常奇怪的日期轉換。這是代碼:非常奇怪的日期轉換

theDateString = [theDateFormatter stringFromDate:date]; 

如果date2007-12-31 00:00:00 +0100 theDateString2008

但如果日期是2004-12-31 00:00:00 +0100 theDateString2004.

的方法是在NSDateFormatter- (NSString *)stringFromDate:(NSDate *)date,這是一個Mac應用程序。

的NSDateFormatter格式爲:[theDateFormatter setDateFormat:@"Y"];

爲什麼? 謝謝

回答