LocalDateTime withSecond(int second) example
Description
LocalDateTime withSecond(int second)
returns a copy of
this LocalDateTime with the second-of-minute value altered.
Syntax
withSecond
has the following syntax.
public LocalDateTime withSecond(int second)
Example
The following example shows how to use withSecond
.
import java.time.LocalDateTime;
/*from w w w .j av a2 s .c o m*/
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);
}
}