I’m creating a countdown timer and I need to printout the time left (hour:minute:seconds) until a specific date. I’ve found how to get the time interval between Now and the target date but I don’t know how to format the time interval as a string. Does NSDateFormater work on NSTimeInterval?
I’m creating a countdown timer and I need to printout the time left (hour:minute:seconds)
Share
You would first compare two NSDate objects to retrieve the difference in seconds between the two, the NSDate method you should use is
Then you could simply write a function to parse the seconds into hours/minutes/seconds, for example you could use this (untested):