When I run this code on iPhone simulator result is 1 (sundey 30. dec, 2012) but when run on iPhone result is 7. Why?
NSCalendar *gregorijan = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateFormater * dateFormat = [[NSDateFormatter alloc] init];
NSDate *newDate = [NSDate date];
......
[dateFormater setDateFormat:[NSString localizedStringWithFormat:@"e"]];
NSLog (@"%d",[[dateFormater stringFromDate:self.newDate] integerValue]);
return [[dateFormater stringFromDate:self.newDate] integerValue];
I have different values on iPhone and simulator ...
Do not set a date format, instead set the date and time style. To short, medium or long. This uses the device locale settings for formatting.