无关风月
2025-02-21 551bbcb098c99afc9f9b58aec7bc16a12f40ed0a
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;
 
    }
}