Code: Select all
Monday 4, November, 2013
Code: Select all
private static String formatDate(Date date) {
Calendar calenDate = Calendar.getInstance();
calenDate.setTime(date);
Calendar today = Calendar.getInstance();
if (calenDate.get(Calendar.DAY_OF_MONTH) == today.get(Calendar.DAY_OF_MONTH)) {
return "Today";
}
today.roll(Calendar.DAY_OF_MONTH, -1);
if (calenDate.get(Calendar.DAY_OF_MONTH) == today.get(Calendar.DAY_OF_MONTH)) {
return "Yesterday";
}
// Guess what buddy
SimpleDateFormat sdf = new SimpleDateFormat("EEEEE d, MMMMM, yyyy");
// This prints "monday 4, november, 2013" ALL in lowercase
return sdf.format(date);
}
UPDATE
Ich komme aus einem hispanischen Land, so etwas wie new Locale("es", "ES") Ich bekomme „martes 7, noviembre, 2013“, wenn ich „Martes 7, Noviembre, 2013“ brauche. .