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 trialMark Junge
1,374 PointsThe mReleaseDate member variable is already stored as a Date object. Convert it and return it using the SimpleDateFormat
I wonder how to do this question from "Build a weather app" I have tried everything from the earlier video, just as i also did when i made the application. Im not sure what they want here, hopefully someone can help me.
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(){
SimpleDateFormat simpledateformat= new SimpleDateFormat("yyyy-MM-dd");
//simpledateformat.setmReleaseDate(mReleaseDate);
String timestring = SimpleDateFormat(mReleaseDate);
return timestring;
}
public void setReleaseDate(Date date) {
mReleaseDate = date;
}
}
2 Answers
christopher vaughan
1,411 PointsYour code is good, except you forgot a method call to "format" so its not actually formatting the date variable.
'''java
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
return simpledateformat.format(mReleaseDate);
'''
note that I removed the "timestring" line as it was unnecessary.
Mark Junge
1,374 PointsThank you, I appreciate it :-)
Mark Junge
1,374 PointsMaybe I can ask you another question :-)
I can't get the pictures from drawables in the project to drawables in the Android. When i copy pictures to the Android, it automatically saves them in project and not Android? I have tried to compare but it doesn't compare all the different sizes hdpi, mdpi......
Im not sure what to do :-)?
NDUMISO MZAMANI SITHOLE
8,650 Pointscan i get the complete code
Mark Junge
1,374 PointsMark Junge
1,374 PointsMy code on the table, might be totally wrong, but just did a lot of different experiments.
So if someone also can explain a bit, it would be fine :-)