Toast.makeText(getBaseContext(),
"Date selected:" + datePicker.getMonth()+1+
"/"+ datePicker.getDayOfMonth() +
"/"+ datePicker.getYear() +"\n" +
"Time Slected:" + timePicker.getCurrentHour() +
":"+ timePicker.getCurrentMinute(),
Toast.LENGTH_SHORT).show();
BY adding 1 to the datePicker.getMonth(),i am getting month number
output like->
jan-01,feb-11,mar-21
But when i removing the “1” i am getting month number output like
jan-0,feb-01,mar-02
You want parentheses.
Otherwise you are doing string concatenation.
For example
If
getMonth()returns 0 (for January), thenis
But with parens