Calendar是Java util包下的日期Api,其中获取月份是当前月份-1
public class Demo { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); System.out.println(new Date().toInstant()); System.out.println(calendar.get(Calendar.MONDAY)); } }