Good evening, I have a method where I get the amount of installments and the starting date. I want to add 1 month to this initial looping date and I'm confused, giving quite a different value:
public void faturar(int parcela, String dataFaturamento) {
try {
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date dtFatura = df.parse(dataFaturamento);
Calendar c = Calendar.getInstance();
c.setTime(dtFatura);
for (int i = 0; i < parcela; i++) {
// Através do Calendar, trabalhamos a data informada e adicionamos 1 mês
c.add(Calendar.MONTH +1,i);
Date dtParcelasGeradas = c.getTime();
System.out.println(dtParcelasGeradas );
}
I wanted my System.out.println to look like this:
09/19/2016 10/19/2016 11/19/2016 12/19/2016 1/19/2017
But the way I'm doing it is showing like this:
Wed Sep 07 00:00:00 BRT 2016 Wed Sep 14 00:00:00 BRT 2016 Wed Sep 28 00:00:00 BRT 2016