In my iPhone app I am converting NSString into NSDate. One string is working fine and returns proper NSDate, but similar kind of another string returns (null). Why this happens?
NSDateFormatter *df =[[NSDateFormatter alloc]init];
df.dateFormat=@"dd MM yyyy";
NSDate *nextMonthDay=[df dateFromString:@"29 01 2015"];
NSLog(@"nextMonthDay %@",nextMonthDay);
// Returns --- nextMonthDay 2015-01-28 18:30:00 +0000
NSDate *nextMonthDay2=[df dateFromString:@"29 02 2015"];
NSLog(@"nextMonthDay %@",nextMonthDay2);
// Returns --- nextMonthDay (null)
Please help me to fix this. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire