minjay26
敬畏每一行代码
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));
    }
}

 

 

posted on 2021-12-31 17:46  minjay26  阅读(47)  评论(0编辑  收藏  举报