Search code examples
androidandroid-datepicker

Is it possible to switch the format of date picker header?


I am trying to change the header on material design date picker as you select a date to a different format than default. Current default is Month , year : ex: june 22, 2021, but I want it such that its Mon, June 22. It's shown on material design document as the first design, but there's no indication of how to go about changing this format? Any ideas? enter image description here

enter image description here

material designs : https://material.io/components/date-pickers

what I want to achieve is this : enter image description here


Solution

  • Unfortunately, you can NOT change Date Format and Local of MaterialDatePicker.

    Since MaterialDatePicker is very restricting, so as many other Material Design Components, I recommend you to use an alternate Date Picker Library such as MaterialDateTimePicker.

    It basically fulfills all your needs:

    • Change date format: setLocale(Locale locale)
    • Choose from multiple date UIs ✅
    • Very flexiable and easily customizlbe to fit your needs ✅

    PS: There is one more popular alternative: android-betterpickers

    Let me know if you have any other questions.