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