Close

Java Date Time - ZonedDateTime.withDayOfYear() Examples

Java Date Time Java Java API 


Class:

java.time.ZonedDateTime

java.lang.Objectjava.lang.Objectjava.time.ZonedDateTimejava.time.ZonedDateTimejava.time.temporal.TemporalTemporaljava.time.chrono.ChronoZonedDateTimeChronoZonedDateTimejava.io.SerializableSerializableLogicBig

Method:

public ZonedDateTime withDayOfYear(int dayOfYear)

Returns a copy of this ZonedDateTime with the day-of-year replaced with the provided 'dayOfYear'

Examples


package com.logicbig.example.zoneddatetime;

import java.time.ZonedDateTime;

public class WithDayOfYearExample {

public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.now();
System.out.println(d);

ZonedDateTime d2 = d.withDayOfYear(200);
System.out.println(d2);
}
}

Output

2017-05-01T16:00:22.093-05:00[America/Chicago]
2017-07-19T16:00:22.093-05:00[America/Chicago]




See Also