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

Android Build a Weather App (2015) Working with JSON Formatting a Date

Taylor Cu
Taylor Cu
1,882 Points

In your new method, add a SimpleDateFormat variable. Use "yyyy-MM-dd" for the format parameter of the constructor.

I'm not really sure what I'm doing wrong. I looked up other solutions and they put SimpleDataFormat outside of the curly braces of getFormattedTime(). So i guess two questions. What am I doing wrong and if SimpleDataFormat is supposed to be on the outside of the braces...Why?

Movie.java
import java.util.Date;

public class Movie {

    private String mTitle;
    private Date mReleaseDate;

    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        mTitle = title;
    }

    public Date getReleaseDate() {
        return mReleaseDate;
    }

    public String getFormattedReleaseDate() {
        SimpleDataFormat formatter = new SimpleDataFormat("yyyy-MM-dd");
        return "";
    }

    public void setReleaseDate(Date date) {
        mReleaseDate = date;
    }
}

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

You misspelled Simple*Date*Formatter as Simple*Data*Formatter

Taylor Cu
Taylor Cu
1,882 Points

Ahhhh shoot haha thank you Seth! Appreciate it! Something so simple.