+(NSDate*)dateFromString:(NSString*)dateStr
{
// Choose your format according to date string
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"dd-MM-yyyy"];
NSDate *date = [dateFormat dateFromString:dateStr];
NSLog(@"String:%@ convert to date:%@",dateStr, date.description);
return date;
}
No comments:
Post a Comment