Calendar calendar = Calendar.getInstance(); long currentTimeInMillis = calendar.getTimeInMillis(); System.out.println(currentTimeInMillis);
Calendar calendar = Calendar.getInstance(); calendar.set(2022, Calendar.JANUARY, 1, 0, 0, 0); long newYearInMillis = calendar.getTimeInMillis(); System.out.println(newYearInMillis);
Calendar calendar = Calendar.getInstance(); calendar.set(2021, Calendar.JANUARY, 1, 0, 0, 0); calendar.add(Calendar.DAY_OF_MONTH, 365); long nextYearInMillis = calendar.getTimeInMillis(); System.out.println(nextYearInMillis);The package library for java.util.Calendar is java.util.