[NSLocale initWithLocaleIdentifier example]
[Example code quoted from Apple Developer Site].
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; |
NSString *usFormatString = [NSDateFormatter dateFormatFromTemplate:@"EdMMM" options:0 locale:usLocale]; |
NSLog(@"usFormatterString: %@", usFormatString); |
// Output: usFormatterString: EEE, MMM d |
NSLocale *gbLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"]; |
NSString *gbFormatString = [NSDateFormatter dateFormatFromTemplate:@"EdMMM" options:0 locale:gbLocale]; |
NSLog(@"gbFormatterString: %@", gbFormatString); |
// Output: gbFormatterString: EEE d MMM |