You need to set the correct time zone. By default, as you can see, UTC is used.
You can use the date format for this.
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
NSTimeZone * timezone = [NSTimeZone timeZoneWithName:@"Europe/Rome"];
[dateFormatter setTimeZone:timezone];
[dateFormatter setTimeStyle:NSDateFormatterFullStyle
];
[dateFormatter setDateStyle:NSDateFormatterFullStyle];
NSLog(@"%@", [dateFormatter stringFromDate:[NSDate date]]);
For a list of available time zones, you can use
NSArray *timeZoneNames = [NSTimeZone knownTimeZoneNames];
or check the constants on this Rails doc page .
source
share