iOS: How do I convert NSDate to NSString?

You can use:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
//Optionally for time zone conversions
[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"..."]];

NSString *stringFromDate = [formatter stringFromDate:myNSDateInstance];
iOS: How do I convert NSDate to NSString? iOS: How do I convert NSDate to NSString? Reviewed by Ricardo Castellanos on 10:42 Rating: 5

No hay comentarios:

Con la tecnología de Blogger.