I am trying to display a date in a datePicker dialog in the format Sep|29|2016 . You can see in the following image.
Expected Result

Unfortunately, most of the time I get 28|M09|2016 rarely, I get the expected result. you can see in the following image
current output

I tried with the following code
public Dialog onCreateDialog(Bundle savedInstanceState) { Calendar calendar = Calendar.getInstance(); System.out.println(calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.US)); calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.US); int yy = calendar.get(Calendar.YEAR); int mm = calendar.get(Calendar.MONTH); int dd = calendar.get(Calendar.DAY_OF_MONTH); System.out.println("yearr==="+yy); System.out.println("monthh==="+mm); System.out.println("dayy==="+dd); DatePickerDialog datepickerdialog = new DatePickerDialog(getActivity(), this,yy,mm,dd); return datepickerdialog; }
Thanks pending.
android android-datepicker datepickerdialog
Sujay
source share