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);
        }
  • 相关阅读:
    docker
    电商项目查询模块思路(ElasticSearch)
    Elasticsearch简单的使用步骤以及查询模块的实现
    string常用方法
    通用 Mapper常用方法
    Linux防火墙操作
    简单SQL语句
    InnoDB基础
    浅析索引
    python爬虫面试题集锦及答案
  • 原文地址:https://www.cnblogs.com/juniorMa/p/15726264.html
Copyright © 2011-2022 走看看