Java Calendar Date

122 Views Asked by At
Calendar now = Calendar.getInstance();
    
    System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1)
                        + "-"
                        + now.get(Calendar.DATE)
                        + "-"
                        + now.get(Calendar.YEAR));

why are we adding +1 to now.get(Calendar.MONTH) to get Current Date? Thanks in advance.

0

There are 0 best solutions below