Language

RelativeDateTimeFormatter.FormatNumericToValue Method

Definition

Format a combination of RelativeDateTimeUnit and numeric offset using a numeric style, e.g. "1 week ago", "in 1 week", "5 weeks ago", "in 5 weeks".

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

Parameters

offset
Double

The signed offset for the specified unit. This will be formatted according to this object's NumberFormat object.

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 numeric style, e.g. "1 week ago", "in 1 week", "5 weeks ago", "in 5 weeks". This method returns a FormattedRelativeDateTime, which exposes more information than the String returned by formatNumeric().

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

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