flavienlaurent / datetimepicker

DateTimePicker is a library which contains the beautiful DatePicker that can be seen in the new Google Agenda app.
1.83k stars 578 forks source link

Get Day of the week (ie. Sunday/Monday) #93

Open kkl260 opened 9 years ago

kkl260 commented 9 years ago

I've tried as much as I could to simply get the Name of the day of the week (Sunday/Monday) but nothing is working for me. I'm either not getting the correct day, or after choosing the date and opening the dialog again and choosing a different date, it's not updating the day.

Is there something specific with this library that I can do to get the day? This is what I've been doing so far:

public void onDateSet(DatePickerDialog datePickerDialog, int year, int month, int day) {

    SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
    Date d = new Date();
    String dayOfTheWeek = sdf.format(d);

    dateBtn.setText(dayOfTheWeek);

}