- (void) dateConverter{
NSString *string = [NSString stringWithFormat:@"%@ %@", [[self dates]objectAtIndex:0], [times objectAtIndex:0]]; // string = 01-10-2014 11:36 AM;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy hh:mm a"];
[dateFormatter setLocale:[NSLocale currentLocale]];
NSDate *date = [[NSDate alloc] init];
date = [dateFormatter dateFromString:string];
NSLog(@"dateFromString = %@", date); // 2014-10-01 18:36:00 +0000
NSTimeInterval timeInterval = [date timeIntervalSince1970];
NSLog(@"dateFromString = %f", timeInterval); // 1412188560.000000
}
I am converting the string
to actual date object, but I am getting different behavior
string = 01-10-2014 11:36 AM
is actual value I am trying to convert but getting this
2014-10-01 18:36:00 +0000
what is wrong with it?