Year from(TemporalAccessor temporal)
creates an instance of Year from a temporal object.
from
has the following syntax.
public static Year from(TemporalAccessor temporal)
The following example shows how to use from
.
import java.time.LocalDate; import java.time.Year; /* w ww .j a v a2 s . c o m*/ public class Main { public static void main(String[] args) { Year y = Year.from(LocalDate.now()); System.out.println(y); } }
The code above generates the following result.