Reputation: 1625
I have string value with date(for ex.: 2012-11-30T12:45:00Z), how can I get value like this: 12:45? Thanks..
Upvotes: 2
Views: 1227
Reputation: 62676
Date formatter approach looks like this:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"hh:mm"];
NSString *hhmm = [dateFormatter stringFromDate:theDate];
// release dateFormatter if not using ARC... but use ARC
Upvotes: 4
Reputation: 2576
NSString* timeStr = [longDateStr substringWithRange:NSMakeRange(11, 5)];
Upvotes: -2