Returns a copy of this ZonedDateTime with nano-of-second replaced with the provided 'nanoOfSecond'.
package com.logicbig.example.zoneddatetime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
public class WithNanoExample {
public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.of(2017, 2, 12, 20, 33, 23, 10000,
ZoneId.systemDefault());
System.out.println(d);
ZonedDateTime d2 = d.withNano(0);
System.out.println(d2);
}
}
Output
2017-02-12T20:33:23.000010-06:00[America/Chicago]
2017-02-12T20:33:23-06:00[America/Chicago]