iOS How To Display Time Until A certain Date in iPhone Programming?

Alanclark

macrumors newbie
Original poster
Nov 30, 2009
2
0
HI,

I was wondering if you someone could help me with somehow showing the exact time (months, days, minutes, even seconds) until an exact date in a text label in iPhone programming.

I'm hoping that when the app is launched, it shows in a label the amount of time from the minute it is opened until a certain date, and it displays in days, hours, minutes, and seconds..

Please include the code...or sample code.

Thanks
 

robbieduncan

Moderator emeritus
Jul 24, 2002
24,778
139
Harrogate
I'm not including code: you'll just copy and paste it and learn the square root of f-all. You need to look at NSDate timeIntervalSinceDate:. This will return an NSTimeInterval (which is in seconds). You should be able to work out how to format that as a string by dividing down to get each component you want.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.