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

Preston Farr
Preston Farr
3,379 Points

Very confused why its refusing my answer

Challenge: "Create a date format using the given 'dateFormatter' variable to display any date with the format of '02/29/2012'. Don't worry about using it for now, just set up the formatter."

I am using the following:

NSTimeInterval secondsPerDay = 60 * 60 * 24;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// Add your code below

NSDate *today = [NSDate date];
NSDate *futureDate = [NSDate dateWithTimeIntervalSinceNow:(secondsPerDay * 10)];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];

The exercise says not worrying about using it so I am confused what else it is looking for. I double checked the "MM/dd/yyyy" using: http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns

And it works in my xcode project to display the month/day/year but for whatever reason it wont compile in the challenge. Is there something additional I should be adding like an NSLog statement? I feel like I am missing something obvious. Has anyone encountered this? I just need a nudge in the right direction

1 Answer