java.time.Period.addTo() 方法示例


java.time.Period.addTo() 方法示例

package com.codingdict;

import java.time.LocalDateTime;
import java.time.Period;

public class PeriodDemo {
   public static void main(String[] args) {

      Period period = Period.of(1,1,1);

      LocalDateTime date = LocalDateTime.now();
      System.out.println(date);  

      date = (LocalDateTime)period.addTo(date);
      System.out.println(date);  
   }
}