Well you can use the following procedure to extract time from the date string
1.Get NSDate object in its given format.
2.Set the NSDateFormatter object with the required format.
3.Get the date string in required format.
- (BOOL)application:(UIApplication *)
application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSString *date = [self convertDate:@"2010-08-24 00:00:00 +0000"
fromFormat:@"yyyy-MM-dd HH:mm:ss ZZZZ"
toFormat:@"hh:mm a"];
NSLog(@"DATE: %@", [date description]);
return YES;
}
- (NSString *)convertDate:(NSString *)inDateString
fromFormat:(NSString *)fromFormat
toFormat:(NSString *)toFormat
{
NSDateFormatter *dateFormatter = nil;
NSString *outDateString = nil;
NSDate *date = nil;
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:fromFormat];
date = [dateFormatter dateFromString:inDateString];
[dateFormatter setDateFormat:toFormat];
outDateString = [dateFormatter stringFromDate:date];
return outDateString;
}