OffsetDateTime withSecond(int second) example
Description
OffsetDateTime withSecond(int second)
returns a copy of
this OffsetDateTime with the second-of-minute value altered.
Syntax
withSecond
has the following syntax.
public OffsetDateTime withSecond(int second)
Example
The following example shows how to use withSecond
.
import java.time.OffsetDateTime;
// w w w . j a v a 2 s.c o m
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.now();
OffsetDateTime d = o.withSecond(34);
System.out.println(d);
}
}
The code above generates the following result.