Share via


TemporalQueries.Precision Method

Definition

A query for the smallest supported unit.

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

Returns

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

Attributes

Remarks

A query for the smallest supported unit.

This queries a TemporalAccessor for the time precision. If the target TemporalAccessor represents a consistent or complete date-time, date or time then this must return the smallest precision actually supported. Note that fields such as NANO_OF_DAY and NANO_OF_SECOND are defined to always return ignoring the precision, thus this is the only way to find the actual smallest supported unit. For example, were GregorianCalendar to implement TemporalAccessor it would return a precision of MILLIS.

The result from JDK classes implementing TemporalAccessor is as follows:<br> LocalDate returns DAYS<br> LocalTime returns NANOS<br> LocalDateTime returns NANOS<br> ZonedDateTime returns NANOS<br> OffsetTime returns NANOS<br> OffsetDateTime returns NANOS<br> ChronoLocalDate returns DAYS<br> ChronoLocalDateTime returns NANOS<br> ChronoZonedDateTime returns NANOS<br> Era returns ERAS<br> DayOfWeek returns DAYS<br> Month returns MONTHS<br> Year returns YEARS<br> YearMonth returns MONTHS<br> MonthDay returns null (does not represent a complete date or time)<br> ZoneOffset returns null (does not represent a date or time)<br> Instant returns NANOS<br>

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

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