无关风月
2025-01-17 ec13fd1fe635ad959142c4308da3206f20a2ca08
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;
 
    }
}