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 trial

iOS Build a Blog Reader iPhone App Adapting Data for Display Formatting Dates with NSDateFormatter

Carlos Lagares
Carlos Lagares
4,332 Points

I have tried to complete the 4/4 questionary of building a Blog Reader and the last one is failing for me.

Converting the futureDate object to a string object

NSString dateString = [dateFormatter stringFromDate:futureDate];

Is there something wrong or missing?

1 Answer

Nick Sint
Nick Sint
4,208 Points

Very small mistake. You forgot the pointer in front of "dateString"! The full code for the whole challenge should be:

NSTimeInterval secondsPerDay = 60 * 60 * 24;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// Add your code below
NSDate *today = [NSDate date];
NSDate *futureDate = [NSDate dateWithTimeIntervalSinceNow:10*secondsPerDay];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];
NSString *dateString = [dateFormatter stringFromDate:futureDate];