View Full Version : How To Display Time Until A certain Date in iPhone Programming?

Nov 30, 2009, 05:03 AM

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.


Nov 30, 2009, 05:22 AM
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: (http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/occ/instm/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.

Nov 30, 2009, 07:50 AM
Hi will you write my program for me? Please include Source Files thanks! lol