LocalDateTime query(TemporalQuery query) example
Description
LocalDateTime query(TemporalQuery<R> query)
queries this date-time
using the specified query.
Syntax
query
has the following syntax.
public <R> R query(TemporalQuery<R> query)
Example
The following example shows how to use query
.
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.TemporalQueries;
/* w ww. j a v a2s .c om*/
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
LocalTime t = a.query(TemporalQueries.localTime());
System.out.println(t);
}
}
The code above generates the following result.