I\'m trying to get the current date with :
NSLog(@\"DATE NOW : %@\", [NSDate date]);
But when I execute it, I have a difference of one hour
You need to set the proper timezone. The default, as you can see, is UTC.
You can use a date formatter for doing that.
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 timezones you can use
NSArray *timeZoneNames = [NSTimeZone knownTimeZoneNames];
or check out the constants here on this Rails doc page.