I have edit text field and I have a method that handles onclick event on edit field and show up a date picker dialog. However I want to change date format in the dialog . It shows Aug 31 2014, I like to show 31 08 2014. Is it possible?
Asked
Active
Viewed 4,003 times
2 Answers
0
This question has been answered elsewhere on the site, here for example. Basically the datepicker dialog shows up in the preferred format of the end user, so if they have their phone or emulator set to mm/dd/yyyy it will show up like that, if you want it to come up dd/mm/yyyy while you are testing it make sure your emulator is set up with that as the preferred date format.

Community
- 1
- 1

JacksonWeekes
- 312
- 3
- 11
0
In DatePickerDialog.OnDateSetListener
you will get onDateSet
method where you can get
int year = selectedYear;
int month = selectedMonth;
int day = selectedDay;
dateCalendar.set(Calendar.YEAR, year);
dateCalendar.set(Calendar.MONTH, month);
dateCalendar.set(Calendar.DAY_OF_MONTH, day);
String monthname = new SimpleDateFormat("MMM").format(dateCalendar.getTime());
in SimpleDateFormat you can change date format as you want

Parag Chauhan
- 35,760
- 13
- 86
- 95
-
Your code format date in the text field in which the date will be shown I like to change date format in the datepicker dialog window – vikifor Aug 31 '14 at 09:16
-
Hello Vikifor ,With the ref http://stackoverflow.com/questions/4499433/datepicker-widget-format , there is no method to set display format – Parag Chauhan Aug 31 '14 at 10:26