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