Eedoh
Eedoh

Reputation: 6278

NSDateFormatter dateFromString returning nil all the time

I know this post is maybe triplicate or so, but none of the answers on existing threads helped me so far.

I'm trying to get NSDate value from string, but I'm constantly getting nil as a result. This is my code

NSString * dateString = cell.lblAlertDate.text;//this value is "06/11/2013 23:55" for example
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
[dateFormatter setDateFormat:@"MM/dd/yyyy HH:mi"];

self.selectedAlarmDate = [dateFormatter dateFromString:dateString];

Upvotes: 1

Views: 605

Answers (1)

vikingosegundo
vikingosegundo

Reputation: 52237

[dateFormatter setDateFormat:@"MM/dd/yyyy HH:mm"];

what is the i doing there …

Upvotes: 3

Related Questions