Re: How to Display a Time Interval


Peter Hudson
 

Hi Dave


I seem to remember using NSCalendatDate and the descriptionWithCalendarFormat: method to get what you want.
NSCalendarDate is now deprecated - the docs advocate the use of NSDate, NSCalendar, NSDateComponents to do the job now.
You have to roll the final string yourself - as far as I can see...

Peter

On 19 May 2019, at 11:02, Dave <dave@looktowindward.com> wrote:

Objective-C, Mac.

Hi,

I’m trying to display a countdown to a date in the future e.g. the number of years, weeks and days to 1/1/2021.

I have the Time Interval between now and the future date in seconds, but I can’t seem to find any methods to display this in terms of years. months, weeks, days etc.

Is there a method or class somewhere that does this or do I need to roll my own?

All the Best
Dave



Join cocoa@apple-dev.groups.io to automatically receive all group messages.