Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement