News for hackers. Stuff that matters.
Re:People in your organization that grow legacy code by ygra on Monday February 24, 2014 @09:15AM (#7290813)

    calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.US)
I guess.

Not that it's necessarily nicer, but generally I'd say duplicating functionality of the standard libraries or frameworks should be avoided if possible.

Re:People in your organization that grow legacy code by msluyter on Monday February 24, 2014 @09:34AM (#7290950)
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();
    }