Language

RelativeDateTimeFormatter.Format メソッド

定義

オーバーロード

Name 説明
Format(RelativeDateTimeFormatter+Direction, RelativeDateTimeFormatter+AbsoluteUnit)

数量を含まない相対日付を書式設定します。

Format(Double, RelativeDateTimeFormatter+RelativeDateTimeUnit)

可能であれば、"last week"、"this week"、"next week"、"yesterday"、"tomorrow" などのテキスト スタイルを使用して、RelativeDateTimeUnit と数値オフセットの組み合わせを書式設定します。

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

"in 5 days" や "3 か月前" などの数量で相対日付を書式設定します。

Format(RelativeDateTimeFormatter+Direction, RelativeDateTimeFormatter+AbsoluteUnit)

数量を含まない相対日付を書式設定します。

[Android.Runtime.Register("format", "(Landroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$AbsoluteUnit;)Ljava/lang/String;", "", ApiSince=24)]
public string? Format(Android.Icu.Text.RelativeDateTimeFormatter.Direction? direction, Android.Icu.Text.RelativeDateTimeFormatter.AbsoluteUnit? unit);
[<Android.Runtime.Register("format", "(Landroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$AbsoluteUnit;)Ljava/lang/String;", "", ApiSince=24)>]
member this.Format : Android.Icu.Text.RelativeDateTimeFormatter.Direction * Android.Icu.Text.RelativeDateTimeFormatter.AbsoluteUnit -> string

パラメーター

direction
RelativeDateTimeFormatter.Direction

NEXT、LAST、THIS など

unit
RelativeDateTimeFormatter.AbsoluteUnit

例: 土曜日、日、月

戻り値

書式設定された文字列。 direction に、すべてのロケールで完全にサポートされていない (NEXT_2やLAST_2など) と記載されている値がある場合、この関数は null を返して、書式設定された文字列が使用できないことを通知する可能性があります。

属性

注釈

数量を含まない相対日付を書式設定します。 このメソッドは文字列を返します。 書式設定の結果の詳細を取得するには、formatToValue() を使用します。

android.icu.text.RelativeDateTimeFormatter.formatの Android リファレンス。

このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。

適用対象

Format(Double, RelativeDateTimeFormatter+RelativeDateTimeUnit)

可能であれば、"last week"、"this week"、"next week"、"yesterday"、"tomorrow" などのテキスト スタイルを使用して、RelativeDateTimeUnit と数値オフセットの組み合わせを書式設定します。

[Android.Runtime.Register("format", "(DLandroid/icu/text/RelativeDateTimeFormatter$RelativeDateTimeUnit;)Ljava/lang/String;", "", ApiSince=28)]
public string? Format(double offset, Android.Icu.Text.RelativeDateTimeFormatter.RelativeDateTimeUnit? unit);
[<Android.Runtime.Register("format", "(DLandroid/icu/text/RelativeDateTimeFormatter$RelativeDateTimeUnit;)Ljava/lang/String;", "", ApiSince=28)>]
member this.Format : double * Android.Icu.Text.RelativeDateTimeFormatter.RelativeDateTimeUnit -> string

パラメーター

offset
Double

指定したフィールドの符号付きオフセット。

unit
RelativeDateTimeFormatter.RelativeDateTimeUnit

相対日付を書式設定するときに使用する単位 (RelativeDateTimeUnit.WEEK、RelativeDateTimeUnit.FRIDAY など)。

戻り値

書式設定された文字列 (エラーが発生した場合は空になる可能性があります)

属性

例外

Android 9 から 15 では、 unit は曜日を指定し、ロケールのオフセットにテキスト用語を使用できません。

注釈

可能であれば、"last week"、"this week"、"next week"、"yesterday"、"tomorrow" などのテキスト スタイルを使用して、RelativeDateTimeUnit と数値オフセットの組み合わせを書式設定します。 オブジェクトのロケールで指定されたオフセットに対して適切なテキスト用語が使用できない場合は、数値スタイルにフォールバックします。 このメソッドは文字列を返します。 書式設定の結果の詳細を取得するには、formatToValue() を使用します。

android.icu.text.RelativeDateTimeFormatter.formatの Android リファレンス。

このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。

適用対象

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

"in 5 days" や "3 か月前" などの数量で相対日付を書式設定します。

[Android.Runtime.Register("format", "(DLandroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$RelativeUnit;)Ljava/lang/String;", "", ApiSince=24)]
public string? Format(double quantity, Android.Icu.Text.RelativeDateTimeFormatter.Direction? direction, Android.Icu.Text.RelativeDateTimeFormatter.RelativeUnit? unit);
[<Android.Runtime.Register("format", "(DLandroid/icu/text/RelativeDateTimeFormatter$Direction;Landroid/icu/text/RelativeDateTimeFormatter$RelativeUnit;)Ljava/lang/String;", "", ApiSince=24)>]
member this.Format : double * Android.Icu.Text.RelativeDateTimeFormatter.Direction * Android.Icu.Text.RelativeDateTimeFormatter.RelativeUnit -> string

パラメーター

quantity
Double

数値の量 (例: 5)。 この値は、このオブジェクトの NumberFormat オブジェクトに従って書式設定されます。

direction
RelativeDateTimeFormatter.Direction

NEXT は将来の相対日付を意味します。LAST は、過去の相対日付を意味します。

unit
RelativeDateTimeFormatter.RelativeUnit

単位 (例: 日)月?年?

戻り値

書式設定された文字列

属性

注釈

"in 5 days" や "3 か月前" などの数量で相対日付を書式設定します。 このメソッドは文字列を返します。 書式設定の結果の詳細を取得するには、formatToValue() を使用します。

android.icu.text.RelativeDateTimeFormatter.formatの Android リファレンス。

このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。

適用対象