zj
2025-01-06 0e7b38c2b3af72ea2a7f8a2fcbaad4d78e2c1977
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.gear.admin.controller.swx;
import java.sql.Date;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
public class test {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime threeDaysLater = now.plus(3, ChronoUnit.DAYS);
        System.out.println("当前日期和时间:" + now);
        System.out.println("三天后的日期和时间:" + threeDaysLater);
        System.out.println("date类型:"+Date.from(threeDaysLater.atZone(ZoneId.systemDefault()).toInstant()));
    }
}