If ww have NSDate object, and we want to convert it into NSString. There are different types of Date strings. How we can do that?, It is very simple. Just 3 steps.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy-MM-dd 'at' HH:mm";
Now, get the formatted string
NSDate *date = [NSDate date]; // your NSDate object NSString *dateString = [dateFormatter stringFromDate:date];
This will give output something like this:
2001-01-02 at 13:00
NSDateFormatter instance is an expensive operation, so it is recommended to create it once and reuse when possible.