YearMonth now(ZoneId zone) example
Description
YearMonth now(ZoneId zone)
creates the current year-month from the system
clock in the specified time-zone.
Syntax
now
has the following syntax.
public static YearMonth now(ZoneId zone)
Example
The following example shows how to use now
.
import java.time.YearMonth;
import java.time.ZoneId;
/*from w w w. j a v a 2 s.c o m*/
public class Main {
public static void main(String[] args) {
YearMonth y = YearMonth.now(ZoneId.systemDefault());
System.out.println(y);
}
}
The code above generates the following result.