NSDateFormatter Locale

前端 未结 4 1939
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条回答
  •  旧时难觅i
    2021-01-05 15:33

    Adding this as I spent some time on trying to NOT use the localized locale in my date formatter.

    From apple docs: Use the system locale when you don’t want any localizations. Use the current locale to format text that you display to users.

    Code: [formatter setLocale:[NSLocale systemLocale]];

提交回复
热议问题