Language

RelativeDateTimeFormatter.FormatToValue Method

Definition

Overloads

Name Description
FormatToValue(Double, RelativeDateTimeFormatter+RelativeDateTimeUnit)

Format a combination of RelativeDateTimeUnit and numeric offset using a text style if possible, e.g. "last week", "this week", "next week", "yesterday", "tomorrow".

FormatToValue(Double, RelativeDateTimeFormatter+Direction, RelativeDateTimeFormatter+RelativeUnit)

Formats a relative date with a quantity such as "in 5 days" or "3 months ago".

FormatToValue(RelativeDateTimeFormatter+Direction, RelativeDateTimeFormatter+AbsoluteUnit)

Formats a relative date without a quantity.

FormatToValue(Double, RelativeDateTimeFormatter+RelativeDateTimeUnit)

Format a combination of RelativeDateTimeUnit and numeric offset using a text style if possible, e.g. "last week", "this week", "next week", "yesterday", "tomorrow".

[Android.Runtime.Register("formatToValue", "(DLandroid/icu/text/RelativeDateTimeFormatter$RelativeDateTimeUnit;)Landroid/icu/text/RelativeDateTimeFormatter$FormattedRelativeDateTime;", "", ApiSince=31)]
public Android.Icu.Text.RelativeDateTimeFormatter.FormattedRelativeDateTime? FormatToValue(double offset, Android.Icu.Text.RelativeDateTimeFormatter.RelativeDateTimeUnit? unit);
[<Android.Runtime.Register("formatToValue", "(DLandroid/icu/text/RelativeDateTimeFormatter$RelativeDateTimeUnit;)Landroid/icu/text/RelativeDateTimeFormatter$FormattedRelativeDateTime;", "", ApiSince=31)>]
member this.FormatToValue : double * Android.Icu.Text.RelativeDateTimeFormatter.RelativeDateTimeUnit -> Android.Icu.Text.RelativeDateTimeFormatter.FormattedRelativeDateTime

Parameters

offset
Double

The signed offset for the specified field.

unit
RelativeDateTimeFormatter.RelativeDateTimeUnit

The unit to use when formatting the relative date, e.g. RelativeDateTimeUnit.WEEK, RelativeDateTimeUnit.FRIDAY.

Returns

The formatted string (may be empty in case of error)

Attributes

Remarks

Format a combination of RelativeDateTimeUnit and numeric offset using a text style if possible, e.g. "last week", "this week", "next week", "yesterday", "tomorrow". Falls back to numeric style if no appropriate text term is available for the specified offset in the object’s locale. This method returns a FormattedRelativeDateTime, which exposes more information than the String returned by format().

Android reference for android.icu.text.RelativeDateTimeFormatter.formatToValue.

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

FormatToValue(Double, RelativeDateTimeFormatter+Direction, RelativeDateTimeFormatter+RelativeUnit)

Formats a relative date with a quantity such as "in 5 days" or "3 months ago".

[Android.Runtime.Register("formatToValue", "(DLandroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$RelativeUnit;)Landroid/icu/text/RelativeDateTimeFormatter$FormattedRelativeDateTime;", "", ApiSince=31)]
public Android.Icu.Text.RelativeDateTimeFormatter.FormattedRelativeDateTime? FormatToValue(double quantity, Android.Icu.Text.RelativeDateTimeFormatter.Direction? direction, Android.Icu.Text.RelativeDateTimeFormatter.RelativeUnit? unit);
[<Android.Runtime.Register("formatToValue", "(DLandroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$RelativeUnit;)Landroid/icu/text/RelativeDateTimeFormatter$FormattedRelativeDateTime;", "", ApiSince=31)>]
member this.FormatToValue : double * Android.Icu.Text.RelativeDateTimeFormatter.Direction * Android.Icu.Text.RelativeDateTimeFormatter.RelativeUnit -> Android.Icu.Text.RelativeDateTimeFormatter.FormattedRelativeDateTime

Parameters

quantity
Double

The numerical amount e.g 5. This value is formatted according to this object's NumberFormat object.

direction
RelativeDateTimeFormatter.Direction

NEXT means a future relative date; LAST means a past relative date.

unit
RelativeDateTimeFormatter.RelativeUnit

the unit e.g day? month? year?

Returns

the formatted relative datetime

Attributes

Remarks

Formats a relative date with a quantity such as "in 5 days" or "3 months ago". This method returns a FormattedRelativeDateTime, which exposes more information than the String returned by format().

Android reference for android.icu.text.RelativeDateTimeFormatter.formatToValue.

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

FormatToValue(RelativeDateTimeFormatter+Direction, RelativeDateTimeFormatter+AbsoluteUnit)

Formats a relative date without a quantity.

[Android.Runtime.Register("formatToValue", "(Landroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$AbsoluteUnit;)Landroid/icu/text/RelativeDateTimeFormatter$FormattedRelativeDateTime;", "", ApiSince=31)]
public Android.Icu.Text.RelativeDateTimeFormatter.FormattedRelativeDateTime? FormatToValue(Android.Icu.Text.RelativeDateTimeFormatter.Direction? direction, Android.Icu.Text.RelativeDateTimeFormatter.AbsoluteUnit? unit);
[<Android.Runtime.Register("formatToValue", "(Landroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$AbsoluteUnit;)Landroid/icu/text/RelativeDateTimeFormatter$FormattedRelativeDateTime;", "", ApiSince=31)>]
member this.FormatToValue : Android.Icu.Text.RelativeDateTimeFormatter.Direction * Android.Icu.Text.RelativeDateTimeFormatter.AbsoluteUnit -> Android.Icu.Text.RelativeDateTimeFormatter.FormattedRelativeDateTime

Parameters

direction
RelativeDateTimeFormatter.Direction

NEXT, LAST, THIS, etc.

unit
RelativeDateTimeFormatter.AbsoluteUnit

e.g SATURDAY, DAY, MONTH

Returns

the formatted string. If direction has a value that is documented as not being fully supported in every locale (for example NEXT_2 or LAST_2) then this function may return null to signal that no formatted string is available.

Attributes

Remarks

Formats a relative date without a quantity. This method returns a FormattedRelativeDateTime, which exposes more information than the String returned by format().

Android reference for android.icu.text.RelativeDateTimeFormatter.formatToValue.

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