ChronoField.GetFrom(ITemporalAccessor) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the value of this field from the specified temporal object.
[Android.Runtime.Register("getFrom", "(Ljava/time/temporal/TemporalAccessor;)J", "", ApiSince=26)]
public long GetFrom(Java.Time.Temporal.ITemporalAccessor? temporal);
[<Android.Runtime.Register("getFrom", "(Ljava/time/temporal/TemporalAccessor;)J", "", ApiSince=26)>]
abstract member GetFrom : Java.Time.Temporal.ITemporalAccessor -> int64
override this.GetFrom : Java.Time.Temporal.ITemporalAccessor -> int64
Parameters
- temporal
- ITemporalAccessor
the temporal object to query, not null
Returns
the value of this field, not null
Implements
- Attributes
Remarks
Gets the value of this field from the specified temporal object. This queries the temporal object for the value of this field. There are two equivalent ways of using this method. The first is to invoke this method directly.
// these two lines are equivalent, but the second approach is recommended
temporal = thisField.getFrom(temporal);
temporal = temporal.getLong(thisField);
It is recommended to use the second approach, getLong(TemporalField), as it is a lot clearer to read in code. Implementations should perform any queries or calculations using the fields available in ChronoField. If the field is not supported an UnsupportedTemporalTypeException must be thrown.
Java reference for java.time.temporal.ChronoField.getFrom.