Aldio Azani
Aldio Azani

Reputation: 41

How to format new datepicker?

i use DatePicker like this

       <DatePicker
            android:id="@+id/DatePicker"
            android:layout_width="match_parent"
            android:layout_height="200sp"
            android:calendarViewShown="false">
        </DatePicker>

this how they look is

enter image description here

How to change DatePicker format to be dd/MM/yyyy, and how to change the months name to be like "Januari, Februari, Maret, April, Mei, ... [indonesian]" ?

Upvotes: 3

Views: 107

Answers (1)

Aditya Vyas-Lakhan
Aditya Vyas-Lakhan

Reputation: 13555

If you want custom months i suggest you to take String array

public static final String[] MONTHS = {"Januari", "Februari", "Maret", "April", .........so on};

either take switch statement

String monthName;
switch(mMonth){
    case Calendar.JANUARY:
        monthName = "Januari";
        break;
    case Calendar.FEBRUARY:
        monthName = "Februari";
        break;

Upvotes: 1

Related Questions