Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlex Cevallos
16,551 PointsWhat is the point of dateWithTimeIntervalSince1970 ?
NSDate *date = [NSDate dateWithTimeIntervalSince1970:entry.date];
is used to state the date for the cell.. I was wondering why we used that method.. instead of just printing the date?
What is the exact point of the method, dateWithTimeIntervalSince1970;
1 Answer
Amit Bijlani
Treehouse Guest TeacherIn THDiaryEntry
the date
property is defined as NSTimerInterval
which is the date represented in seconds. In other words the number of seconds elapsed between the current day and 1/1/1970. To convert the number of seconds into an NSDate
object you have to do: NSDate *date = [NSDate dateWithTimeIntervalSince1970:entry.date];
Alex Cevallos
16,551 PointsAlex Cevallos
16,551 PointsThanks Amit!! So lucky to be learning from such a great set of instructors! Can't wait to complete the iOS track and then try out the mobile game design & iOS sprite kit tutorial!