OffsetDateTime withDayOfMonth(int dayOfMonth)
returns a copy
of this OffsetDateTime with the day-of-month altered.
withDayOfMonth
has the following syntax.
public OffsetDateTime withDayOfMonth(int dayOfMonth)
The following example shows how to use withDayOfMonth
.
import java.time.OffsetDateTime; public class Main { public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); OffsetDateTime d = o.withDayOfMonth(1); System.out.println(d); } }
The code above generates the following result.