Skip to content Skip to sidebar Skip to footer

After Selecting Date, Its Showing Wrong Month

I'm using datepicker, but whenever I'm selecting any date its showing -1 moneth. For example- If I select 12/12/2016, it'll display in textbox 12/11/2016 If I select 3/1/2017, it'l

Solution 1:

In this case, the month count is started at 0. So you have to add 1 for display.

  editStartDate.setText(selectedday + "/" + (selectedmonth + 1) + "/" + selectedyear);

See also this question for reference: Why is January month 0 in Java Calendar?

Post a Comment for "After Selecting Date, Its Showing Wrong Month"