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