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

Convert the 'futureDate' object to a string object named 'dateString'.

Hi,

So I've been waiting for the final chapters of the Blog Reader course and I seem to have forgotten some things. I'm struggling with the final code challenge and have tried various things. Can anyone please help? I know this is a really simple answer as well, but having gotten stuck I tried to copy the code from the tutorial video and I still can't manage it.

Thanks for helping.

Code:

NSString *futureDateString = [dateFormatter stringFromDate:dateString];

5 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Ahh sorry missed the fact that you are trying to convert dateString. The method stringFromDate expects you to provide it a date which in this case is futureDate that you created previously. So your code should look like:

NSString *dateString = [dateFormatter stringFromDate:futureDate];
Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Your code is right except the challenge is expecting you to create a string named dateString. So just rename futureDateString to dateString.

It's still comping up with a compilation error, Amit

NSString *dateString = [dateFormatter stringFromDate:dateString];

Brilliant!

Thanks so much for your help, Amit, it's really appreciated.

Ashley

You're a true legend Amit Bijlani love your work!