Have you tried creating an NSDate
from that and printing that using an NSDateFormatter
?
NSDate *date = [NSDate dateWithTimeIntervalSince1970:[theNumber doubleValue]];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH:mm:ss"];
NSLog(@"%@", [formatter stringFromDate:date]);
[formatter release];
If you need the individual values for hours, minutes, and seconds, use NSDateComponents
as suggested by nall.
The above won’t print the correct amounts if the NSNumber
represents more than one day. It could be 1 day and 1 hour, and it would only print 01:00:00. In such a case you should calculate hours, minutes and seconds manually.