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));
  • 相关阅读:
    打包下载,byte[] ,
    .net mvc 异常处理 IExceptionFilter,保存请求参数
    c# webapi websocket 服务端消息发送
    mailkit用163发邮件
    使用OPCAutomation实现对OPC数据的访问,“对 COM 组件的调用返回了错误 HRESULT E_FAIL”错误
    .net core 获取客户端ip
    C#读取OPC server
    Makedown语言常用语法
    ops:Rsync和Scp区别
    ops:Linux /bin,/sbin,/usr/sbin, /usr/local/bin区别
  • 原文地址:https://www.cnblogs.com/mingforyou/p/14812958.html
Copyright © 2011-2022 走看看