OffsetDateTime withSecond(int second)
returns a copy of
this OffsetDateTime with the second-of-minute value altered.
withSecond
has the following syntax.
public OffsetDateTime withSecond(int second)
The following example shows how to use withSecond
.
import java.time.OffsetDateTime; 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.