NSDateFormatter Locale

前端 未结 4 1856
Happy的楠姐
Happy的楠姐 2021-01-05 15:19

How to set Locale for NSDateFormatter? I\'ve tried the below code and its not working.

- (NSString *)localizedStringWithFormat:(NSString *)format {

    NSDa         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-05 15:39

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSLocale *locale = [[NSLocale alloc] 
                         initWithLocaleIdentifier:@"he"];
    [dateFormatter setLocale:locale];
    

提交回复
热议问题