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())); } }