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