I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The date/time conversion code is going to be moved outside the asynctask later, | |
* so for convenience we're breaking it out into its own method now. | |
*/ | |
private String getReadableDateString(long time){ | |
// Because the API returns a unix timestamp (measured in seconds), | |
// it must be converted to milliseconds in order to be converted to valid date. | |
SimpleDateFormat shortenedDateFormat = new SimpleDateFormat("EEE MMM dd"); | |
return shortenedDateFormat.format(time); | |
} | |