[Solved] How to get number of days between today’s date and last date of the current month? [closed]


    Calendar calendar = Calendar.getInstance();
    int lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    int currentDay = calendar.get(Calendar.DAY_OF_MONTH);
    int daysLeft = lastDay - currentDay;


    System.out.println("Last Day: " + lastDay);
    System.out.println("Current Day : " + currentDay);
    System.out.println("There are " + daysLeft + " days left in the month.");

output

Last Day: 30
Current Day : 1
There are 29 days left in the month.

2

solved How to get number of days between today’s date and last date of the current month? [closed]