zoukankan      html  css  js  c++  java
  • LocalDateTime 日期

    //当天的零点
                wrapper.ge(PcTodayQuotation::getCreateTime,LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MIN));
                //当天的最后时间
                wrapper.le(PcTodayQuotation::getCreateTime,LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MAX));
    LocalDateTime curDateTime =  LocalDateTime.now();
    curDateTime.plusDays(-1);

    curDateTime.minusDays(i).toLocalDate()
            //当天的零点
            System.out.println("当天的零点:  "+LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MIN));
            //当天的最后时间
            System.out.println("当天的最后时间:  "+LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MAX));
                //i天前的零点
            System.out.println("1天前的零点: "+LocalDateTime.of(LocalDateTime.now().minusDays(1).toLocalDate(), LocalTime.MIN));
                //i天前的最后时间
            System.out.println("1天前的最后时间: "+LocalDateTime.of(LocalDateTime.now().minusDays(1).toLocalDate(), LocalTime.MAX));
                //1月前的零点
            System.out.println("1月前的零点: "+ LocalDateTime.of(LocalDateTime.now().minusMonths(1).withDayOfMonth(1).toLocalDate(), LocalTime.MIN));
                //i天前的最后时间
            System.out.println("1月前的最后时间: "+ LocalDateTime.of(LocalDateTime.now().minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).toLocalDate(), LocalTime.MAX));
            //1年前的零点
            System.out.println("1年前的零点: "+LocalDateTime.of(LocalDateTime.now().minusYears(1).withDayOfYear(1).toLocalDate(), LocalTime.MIN));
            //i年前的最后时间
            System.out.println("1年前的最后时间: "+LocalDateTime.of(LocalDateTime.now().minusYears(1).with(TemporalAdjusters.lastDayOfYear()).toLocalDate(), LocalTime.MAX));
    LocalDateTime localDateTime = LocalDateTime.now();
            Month month = localDateTime.getMonth();
            Month firstMonthOfQuarter = month.firstMonthOfQuarter();
            Month endMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2);
            LocalDate localDate_start = LocalDate.of(localDateTime.getYear(), firstMonthOfQuarter, 1);
            LocalDate localDate_end = LocalDate.of(localDateTime.getYear(), endMonthOfQuarter, 1);
            //1季前的零点
            System.out.println("1季前的零点: "+ LocalDateTime.of(localDate_start.minusMonths(1*3).withDayOfMonth(1), LocalTime.MIN));
            //i季前的最后时间
            System.out.println("1季前的最后时间: "+ LocalDateTime.of(localDate_end.minusMonths(1*3).with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX));
  • 相关阅读:
    BZOJ 3674: 可持久化并查集加强版 可持久化并查集
    Codeforces Round #228 (Div. 1) C. Fox and Card Game 博弈
    Codeforces Round #228 (Div. 1) B. Fox and Minimal path 构造
    Codeforces Round #228 (Div. 1) A. Fox and Box Accumulation 贪心
    2016 UESTC Training for Data Structures 题解
    Codeforces Round #349 (Div. 1) B. World Tour 暴力最短路
    HDU 5344 MZL's xor 水题
    Codeforces Round #349 (Div. 1) A. Reberland Linguistics 动态规划
    Codeforces Beta Round #11 B. Jumping Jack 数学
    Codeforces Beta Round #11 A. Increasing Sequence 贪心
  • 原文地址:https://www.cnblogs.com/mingforyou/p/14812958.html
Copyright © 2011-2022 走看看