I am trying to display date in datePicker
dialog in a format like Sep|29|2016
. you can see in following image.
Expected output
unfortunately most of the time i am getting 28|M09|2016
rarely i am getting expected output. you can see in following image
current output
I have tried with 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 in anticipation.
from Month name is appearing with M+number in datePicker dialog in android
No comments:
Post a Comment