I am new to Java and I am trying to get the yesterday date with the following code:
GregorianCalendar gc = new GregorianCalendar(2018,9,22);//<-Today
gc.add(gc.DATE, -1);//<-Yesterday
SimpleDateFormat dateFormatter = new SimpleDateFormat("DD-MMM-YYYY");
System.out.println(dateFormatter.format(gc.getTime()));
The output I'm getting is:
325-XI-2018
What am I doing wrong?