Share via


TemporalQueries.LocalTime Method

Definition

A query for LocalTime returning null if not found.

[Android.Runtime.Register("localTime", "()Ljava/time/temporal/TemporalQuery;", "", ApiSince=26)]
public static Java.Time.Temporal.ITemporalQuery? LocalTime ();
[<Android.Runtime.Register("localTime", "()Ljava/time/temporal/TemporalQuery;", "", ApiSince=26)>]
static member LocalTime : unit -> Java.Time.Temporal.ITemporalQuery

Returns

a query that can obtain the time of a temporal, not null

Attributes

Remarks

A query for LocalTime returning null if not found.

This returns a TemporalQuery that can be used to query a temporal object for the local time. The query will return null if the temporal object cannot supply a local time.

The query implementation examines the ChronoField#NANO_OF_DAY NANO_OF_DAY field and uses it to create a LocalTime.

The method ZoneOffset#from(TemporalAccessor) can be used as a TemporalQuery via a method reference, LocalTime::from. This query and LocalTime::from will return the same result if the temporal object contains a time. If the temporal object does not contain a time, then the method reference will throw an exception, whereas this query will return null.

Java documentation for java.time.temporal.TemporalQueries.localTime().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to