LocalDateTime withSecond(int second)
returns a copy of
this LocalDateTime with the second-of-minute value altered.
withSecond
has the following syntax.
public LocalDateTime withSecond(int second)
The following example shows how to use withSecond
.
import java.time.LocalDateTime; /*from w ww. ja va 2 s . c om*/ public class Main { public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 01); LocalDateTime t = a.withSecond(1234); System.out.println(t); } }