3 ms·
Well, this gets you the day of the week for whatever the current time is. The example in the article didn't do that exactly. It took a string of some sort (in w
by msluyter 13y ago
Well, this gets you the day of the week for whatever the current time is. The example in the article didn't do that exactly. It took a string of some sort (in what format, exactly, isn't clear to me) and mapped it to another string.
Assuming that the input string is a formatted date of some sort, then I think this would work, using JodaTime (minus exception handling):
public String getDayOfWeek(String s) {
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy");
DateTime dt = formatter.parseDateTime(s);
return dt.dayOfWeek().getAsText();
}