ZonedDateTime withDayOfMonth(int dayOfMonth)
returns a copy of this ZonedDateTime with the day-of-month value altered.
withDayOfMonth
has the following syntax.
public ZonedDateTime withDayOfMonth(int dayOfMonth)
The following example shows how to use withDayOfMonth
.
import java.time.ZonedDateTime; 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.