0

I would like to open DatePickerDialog in dd/MM/yyyy format while my phone locale is set to English(United Stated) which has default format "MM/dd/yyyy".

I know in iOS they have DatePicker.locale method to specify locale for that particular datepicker but I don't know how can I do this with android.

Or is there anyway we can give datepicker our own date format ?

Help needed!

Thanks.

Mohit Charadva
  • 2,555
  • 1
  • 22
  • 30
  • 1
    [Please follow following link.It may be helpful][1] [1]: http://stackoverflow.com/questions/7208769/android-how-to-change-the-datepicker-view-date-format-from-mm-dd-yyyy-to-dd-mm/7209641#7209641 – App Kart Apr 14 '14 at 12:39

1 Answers1

0

This may help you to get the view

 DatePickerDialog datepicker =new DatePickerDialog(context, callBack, year, monthOfYear, dayOfMonth) DatePickerDialog(this);

try {
    Field f[] = datepicker.getClass().getDeclaredFields();
    for (Field field : f) 
    {
    Log.i("Field Name :",field.getName())
    }

once you have name of both fields you want to move (probably you will have to guess it). you can swap the views .

convert Field to View by :

            field.setAccessible(true);
            Object month = new Object();
            month = field.get(datepicker);
            // ((View)month) typecast to convert it to view
Dilroop Singh
  • 544
  • 6
  • 16