package J20250808.localDateTime;

import java.time.LocalDateTime;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo04_LocalDateTimeTest
 * @description
 * @create 2025/8/8
 */
public class Demo04_LocalDateTimeTest {
    public static void main(String[] args) {
        LocalDateTime dateTime = LocalDateTime.of(2012, 2, 3, 15, 6, 35);

        //添加或者减去年     public LocalDateTime plusYears (long years)
        LocalDateTime dateTime1 = dateTime.plusYears(10);
        System.out.println(dateTime1);
        LocalDateTime dateTime2 = dateTime.plusYears(-20);
        System.out.println(dateTime2);
        //添加或者减去月     public LocalDateTime plusMonths(long months)
        //添加或者减去日     public LocalDateTime plusDays(long days)
        //添加或者减去时     public LocalDateTime plusHours(long hours)
        //添加或者减去分     public LocalDateTime plusMinutes(long minutes)
        //添加或者减去秒     public LocalDateTime plusSeconds(long seconds)
        //添加或者减去周     public LocalDateTime plusWeeks(long weeks)
    }
}
