ZonedDateTime withSecond(int second)
returns a copy of this ZonedDateTime
with the second-of-minute value altered.
withSecond
has the following syntax.
public ZonedDateTime withSecond(int second)
The following example shows how to use withSecond
.
import java.time.ZonedDateTime; public class Main { public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ZonedDateTime n = dateTime.withSecond(1234); System.out.println(n); } }