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];

Leave a Comment

Copyright © 2019 Soulmedic Theme All Rights Reserved | Design Themes

Atomic Flavor