2

I'm working on a kind of tricky app where the day of the week is important.

To avoid to much hassle, here is my main problem:

I have a DatePickerDialog where the user selects a date. I want to know what day of the week this date is.

I'm thinking this should be easy, but somehow I can't figure it out.

I've tried a few things like using: Calendar.DAY_OF_WEEK - I can only get it to return todays day Date.parse("1.16.2012").toString("dddd") - Didn't get this to work at all

I really don't want to create a whole new calendar just for this simple problem.

Anyone good ideas guys?

avim
  • 979
  • 10
  • 25
LordMarty
  • 1,551
  • 1
  • 12
  • 17

1 Answers1

2

Very quickly, the date picker gives you year, month and day:

dayOfWeek = DateFormat.format("EE", new Date(year, month, day)).toString();

Iron the bugs I probably left yourself, sorry =)

Best regards.

pouzzler
  • 1,800
  • 2
  • 20
  • 32