YearMonth atDay(int dayOfMonth)
combines this year-month with a day-of-month to create a LocalDate.
atDay
has the following syntax.
public LocalDate atDay(int dayOfMonth)
The following example shows how to use atDay
.
import java.time.LocalDate; import java.time.YearMonth; /*from www . j a v a 2 s . c o m*/ public class Main { public static void main(String[] args) { YearMonth y = YearMonth.now(); LocalDate l = y.atDay(2); System.out.println(l); } }
The code above generates the following result.