0
I have an Android app that tests whether the dates stored in bank exceeded the time limit to perform a new data capture through a certain 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 is Dec
should be Nov
(month 11). What I’m doing wrong?
Thank you very much!
– Rodrigo Ferraz