zoukankan      html  css  js  c++  java
  • JDK8 时间api当天的开始和截至时间

    public static Date getTodayStart() {
            LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
            Instant instant = todayStart.atZone(ZoneId.systemDefault()).toInstant();
            return Date.from(instant);
        }
    
        public static Date getTodayEnd() {
            LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
            Instant instant = todayStart.atZone(ZoneId.systemDefault()).toInstant();
            return Date.from(instant);
        }
    
        public static Date getSomeDayStart(int plusDays) {
            LocalDateTime todayStart = LocalDateTime.of(LocalDate.now().plusDays(plusDays), LocalTime.MIN);
            Instant instant = todayStart.atZone(ZoneId.systemDefault()).toInstant();
            return Date.from(instant);
        }
    
        public static Date getSomeDayEnd(int plusDay) {
            LocalDateTime todayStart = LocalDateTime.of(LocalDate.now().plusDays(plusDay), LocalTime.MAX);
            Instant instant = todayStart.atZone(ZoneId.systemDefault()).toInstant();
            return Date.from(instant);
        }
  • 相关阅读:
    集合合并
    非递减有序集合合并
    有序的双链表的实现
    单链表的实现
    构造有序的单链表
    约瑟夫环问题
    javaweb学习笔记
    Intellij IDEA快捷键
    JAVA:创建类和对象
    JAVA:成员变量和局部变量的区别
  • 原文地址:https://www.cnblogs.com/juniorMa/p/15726264.html
Copyright © 2011-2022 走看看