[Solved] iOS After NSDateFormatter Date is nil [duplicate]


Use a dateFormat string of @"yyyy-MM-dd HH:mm:ss Z" instead. Your dateFormat does not match the format of the string you’re trying to convert.

By the way, there’s no point in converting [NSDate date] to a string and back again. Just use [NSDate date] and be done with it:

NSDate *compareDateNow = [NSDate date];
NSComparisonResult result = [compareDateNow compare:compareDateFinish];

The same might be true for [device valueForKey:@"finishDate"]. If that’s already a NSDate object, just use that and bypass the formatter entirely.

solved iOS After NSDateFormatter Date is nil [duplicate]