-1

By default onSelectedDayChange() of calendarView diplay's month as an integer value like:- 1-1-2021. But I want the format as 1-Jan-2021. Please help out.

Thanks in Advance!!

Meet
  • 21
  • 6

1 Answers1

1

you can use the DateFormatSymbols class and get the list of months in String

  calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int dayOfMonth) {
            DateFormatSymbols dateFormatSymbols = new DateFormatSymbols();
            String mMonth = dateFormatSymbols.getMonths()[month - 1];
        }
    });
Shay Kin
  • 2,539
  • 3
  • 15
  • 22