NSDate from NSString gives null result
问题 I am using following code to generate NSDate -> NSString +(NSString *)getCurrentTime { NSDate *now = [NSDate date]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"dd-MM-yyyy hh:MM:SS a"]; [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; NSString* str =[dateFormatter stringFromDate:now]; [dateFormatter release]; NSLog(@"%@",str); return str; } everything is fine in above code. I am using above code to store string in