zhibing.pu
2024-08-31 f6125b320b78b36c439e85d926cb2b11cd71fc6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.ruoyi.order.util;
 
import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.TemporalAdjusters;
 
public class PreviousSixMonths {
    public static LocalDate get() {
        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
 
        // 计算六个月前的日期
        LocalDate sixMonthsAgo = currentDate.minusMonths(6);
 
        // 调整为该月的第一天
        LocalDate firstDayOfSixMonthsAgo = sixMonthsAgo.with(TemporalAdjusters.firstDayOfMonth());
        return firstDayOfSixMonthsAgo;
 
    }
}