ZonedDateTime withDayOfMonth(int dayOfMonth) example
Description
ZonedDateTime withDayOfMonth(int dayOfMonth)
returns a copy of this ZonedDateTime with the day-of-month value altered.
Syntax
withDayOfMonth
has the following syntax.
public ZonedDateTime withDayOfMonth(int dayOfMonth)
Example
The following example shows how to use withDayOfMonth
.
import java.time.ZonedDateTime;
/* w w w . ja v a2s.c o m*/
public class Main {
public static void main(String[] args) {
ZonedDateTime dateTime = ZonedDateTime.now();
ZonedDateTime n = dateTime.withDayOfMonth(14);
System.out.println(n);
}
}
The code above generates the following result.