-Mike
How to get the day of the week using the DatePicker widget
|
How to get the day of the week using the DatePicker widget created on Nov 4, 2010 7:26:22 PM -Mike |
|
|
RE: How to get the day of the week using the DatePicker widget created on Nov 5, 2010 6:33:40 AM Mike A I am developing a To Do List application and I am using th DatePicker widget to have the user set the date the the task should be completed by. I can get the day, month, and the year out of that. When I put that information into an android.text.format.Time object called t by doing t.set(seconds, minutes, hours, day, month, year) I was expecting t.weekDay to give the me day of the week [0-6] with 0 representing Sunday and 6 being Saturday. When I use that it always returns 0 because it doesn't the actual date doesn't determine the weekDay, it will just return what was explicitly set(since nothing is set it returns 0, so it thinks everyday is Sunday). Any recommendations on what I can do? -Mike Try using java.util.Calendar. You set the date information the same as an android.text.format.Time object, then call yourCalendar.complete (); first. Then you would get the day of the week by: yourCalendar.get (java.util.Calendar.DAY_OF_WEEK); |
