Returns a copy of this ZonedDateTime with month-of-year replaced with the provided 'month'
The returned time zones are different between of daylight saving changes.
package com.logicbig.example.zoneddatetime;
import java.time.ZonedDateTime;
public class WithMonthExample {
public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.now();
System.out.println(d);
ZonedDateTime d2 = d.withMonth(1);
System.out.println(d2);
ZonedDateTime d3 = d.withMonth(12);
System.out.println(d3);
}
}
Output
2017-05-01T16:00:07.467-05:00[America/Chicago]
2017-01-01T16:00:07.467-06:00[America/Chicago]
2017-12-01T16:00:07.467-06:00[America/Chicago]