NSDate returns the wrong year

In the file MyappAppDelegate.m in the method "application: didFinishLaunchingWithOptions:" I simply wrote:

NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat:@"yyyy"]; NSDate *date = [NSDate date]; NSLog(@"%@", [df stringFromDate:date]); return; 

And ran with iPhoneSimulator, the console said:

2010-10-15 20: 38: 43.571 Myapp [59828: 207] 0022

I do not understand what's going on.

So, I created a new Xcode project and tested as described above, after which it returned "2010" correctly. Did I make some bad settings in Myapp?

Thanks in advance.

+4
source share
1 answer

You are using the Japanese calendar.
Check settings / General / International / Calendar. Set it back to gregorian.

+4
source

All Articles