iOS NSDate本地化
1.
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
    [outputFormatter setLocale:[NSLocale currentLocale]];
    [outputFormatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"];
NSLog(@"%@",[outputFormatter stringFromDate:[NSDate date]);
2.
NSString *deviceLanguage = [[NSLocale preferredLanguages] objectAtIndex:0]; NSDateFormatter *dateFormatter = [NSDateFormatter new]; NSLocale *locale = [[NSLocale alloc]initWithLocaleIdentifier:deviceLanguage]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss EEEE dd MMMM"]; [dateFormatter setLocale:locale]; NSLog(@"\nLocal Time = %@",[dateFormatter stringFromDate:[NSDate date]]);
    Stay hungry,stay foolish.
                    
                
                
            
        
浙公网安备 33010602011771号