How can I convert a NSTimeInterval
to NSDate
? Think of it like a stopwatch. I want the initial date to be 00:00:00, and I have a NSTimeInterv
Via apple developers:
//1408709486 - time interval value
NSDate *lastUpdate = [[NSDate alloc] initWithTimeIntervalSince1970:1408709486];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
NSLog(@"date time: %@", [dateFormatter stringFromDate:lastUpdate]);
You will get: date time: Aug 22, 2014, 3:11:26 PM