The locale to use when formatting relative dates.
Instance Method
インスタンスメソッド
locale(_:)
Modifies the relative date format style to use the specified locale.
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
- Xcode 13.0+
Technology
- Foundation ファウンデーション
Declaration 宣言
func locale(_ locale: Locale
) -> Date
.RelativeFormatStyle
Parameters パラメータ
locale
Return Value 戻り値
A relative date format style with the provided locale.
Relationships 関係
From Protocol 由来プロトコル
See Also 参照
Modifying a Relative Date Format Style
static func relative(presentation: Presentation, unitsStyle : UnitsStyle) -> Date.RelativeFormatStyle
Returns a relative date format style based on the provided presentation and unit style.
var presentation: Date.RelativeFormatStyle.Presentation
Specifies the style to use when describing a relative date, such as “1 day ago” or “yesterday”.
var unitsStyle : Date.RelativeFormatStyle.UnitsStyle
The style to use when formatting the quantity or the name of the unit, such as “1 day ago” or “one day ago”.
単位の量または名前を書式設定する時に使う様式、たとえば “1 day ago” または “one day ago”。
var calendar: Calendar
The calendar to use when formatting relative dates.
var capitalizationContext : FormatStyleCapitalizationContext
The capitalization context to use when formatting the relative dates.
var locale: Locale
The locale to use when formatting the relative date.