You can convert it to an NSDate
using the NSDateFormatter
.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy/MM/dd"];
NSdate *date = [dateFormatter dateFromString:@"2012/03/17"];
Be aware that allocating an NSDateFormatter
is a pretty heavy task so if you are parsing a lot of dates then allocate it once and keep it around 🙂
solved how to I convert a string with format “YYYY/MM/DD” into NSDate type? [duplicate]