I’m using this android calendar http://w2davids.wordpress.com/android-simple-calendar/ and attempting to populate it with events.
In the code below, it has an example of taking the dateCreated, which I assume is a timestamp, and does some sort of conversion on it. What does “dd” do?
I want to know what “day” is so I can tailor it to my own data.
/**
* NOTE: YOU NEED TO IMPLEMENT THIS PART Given the YEAR, MONTH, retrieve
* ALL entries from a SQLite database for that month. Iterate over the
* List of All entries, and get the dateCreated, which is converted into
* day.
*
* @param year
* @param month
* @return
*/
private HashMap findNumberOfEventsPerMonth(int year, int month)
{
System.out.println("BARGH!");
HashMap map = new HashMap<String, Integer>();
// DateFormat dateFormatter2 = new DateFormat();
//
// String day = dateFormatter2.format("dd", dateCreated).toString();
//
// if (map.containsKey(day))
// {
// Integer val = (Integer) map.get(day) + 1;
// map.put(day, val);
// }
// else
// {
// map.put(day, 1);
// }
return map;
}
Look at SimpleDateFormat for the formatting options you have. For example ‘dd’ will give you the day of month in 2 digits.