package com.lovecoding.day14.api02;

import org.junit.Test;

import java.time.*;

public class TestDate02 {

    //zoneId 和 ZonedDateTime
    @Test
    public void test04() throws InterruptedException {
        for (String availableZoneId : ZoneId.getAvailableZoneIds()) {
            System.out.println(availableZoneId);
        }

        System.out.println("----------");

        ZonedDateTime now = ZonedDateTime.now();
        System.out.println(now);

        ZonedDateTime now1 = ZonedDateTime.now(ZoneId.of("US/Pacific"));
        System.out.println(now1);
    }

    //LocalTime
    @Test
    public void test03() throws InterruptedException {
        LocalTime localTime = LocalTime.now();
        System.out.println(localTime);

        LocalTime localTime1 = localTime.minusSeconds(1200);
        System.out.println(localTime1);
    }

    @Test
    public void test02() throws InterruptedException {
        LocalDateTime localDateTime = LocalDateTime.of(2000,2,20,12,12,12);
        System.out.println(localDateTime);

        LocalDateTime localDateTime1 = localDateTime.plusDays(200);
        System.out.println(localDateTime1);
    }

    @Test
    public void test01() throws InterruptedException {
        //LocalDate
        LocalDate localDate = LocalDate.now();
        System.out.println(localDate);

        //plus
        LocalDate localDate1 = localDate.plusDays(100);
        System.out.println(localDate1);

        //minus
        LocalDate localDate2 = localDate.minusYears(10);
        System.out.println(localDate2);

        //with
        LocalDate localDate3 = localDate.withMonth(3);
        System.out.println(localDate3);
    }
}
