iOS中Android的等效Locale.US是什么
我是iOS新手。在我的android应用程序中,要将毫秒转换为日期,Local.US用作区域设置。iOS中的等效函数是什么 顺便说一句,我使用以下代码:iOS中Android的等效Locale.US是什么,ios,Ios,我是iOS新手。在我的android应用程序中,要将毫秒转换为日期,Local.US用作区域设置。iOS中的等效函数是什么 顺便说一句,我使用以下代码: NSDate *eeDate = [[NSDate alloc] initWithTimeIntervalSince1970:seconds]; NSTimeZone *timeZone = [NSTimeZone localTimeZone]; NSDateFormatter *dFormatter = [[NSDateFormatter
NSDate *eeDate = [[NSDate alloc] initWithTimeIntervalSince1970:seconds];
NSTimeZone *timeZone = [NSTimeZone localTimeZone];
NSDateFormatter *dFormatter = [[NSDateFormatter alloc] init];
[dFormatter setTimeZone:timeZone];
[dFormatter setDateFormat:@"yyyy/MM/dd hh:mm a"];
result = [dFormatter stringFromDate:eeDate];
我所理解的是,它在手机中设置了本地时区。但我想在Android中获得与Locale.US相当的版本
请建议 等价物是
[NSLocale localewithlocaleignifier:@“en_US”]
要将其与NSNumberFormatter
一起使用,请尝试:
NSLocale *usLocale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
NSDateFormatter *dFormatter = [[NSDateFormatter alloc] init];
[dFormatter setDateFormat:@"yyyy/MM/dd hh:mm a"];
[dFormatter setLocale:usLocale];
NSString *result = [dFormatter stringFromDate:eeDate];