I have an Android application that tests whether data stored in a database has exceeded the time limit to perform a new data capture through a particular function. I was able to add the values of the database to the Calendar object, but the object is always modified with 1 month more than what was actually passed to it.
Calendar dataBancoDor = Calendar.getInstance();
int diaDor = Integer.parseInt(dataDor.substring(0,2)); //29
int mesDor = Integer.parseInt(dataDor.substring(3,5)); //11
int anoDor = Integer.parseInt(dataDor.substring(6,10)); //2017
dataBancoDor.set(anoDor,mesDor,diaDor); // (2017,11,29)
String teste1 = String.valueOf(dataBancoDor.getTime()); // Fri Dec 29 2017
Where Dec
should be Nov
(month 11). What am I doing wrong?