Period addTo(Temporal temporal)
adds this period to the specified temporal object.
addTo
has the following syntax.
public Temporal addTo(Temporal temporal)
The following example shows how to use addTo
.
import java.time.LocalDate; import java.time.Period; import java.time.temporal.Temporal; /*from w ww. j av a 2 s.c om*/ public class Main { public static void main(String[] args) { Period p = Period.ofDays(12); Temporal l = p.addTo(LocalDate.now()); System.out.println(l); } }
The code above generates the following result.