The hour format style to apply to the date interval format style.
日付間隔書式設定スタイルへと適用することになる時間書式設定。
Return Value
戻り値
A date interval format style that includes the specified hour style.
ある日付間隔書式設定スタイル、それは指定された時間スタイルを含みます。
Discussion
議論
The values of Date.FormatStyle.Symbol.Hour are defaultDigitsNoAMPM and twoDigitsNoAMPM.Date.FormatStyle.Symbol.Hourの値は、defaultDigitsNoAMPMとtwoDigitsNoAMPMです。
This example shows a variety of Date.FormatStyle.Symbol.Hour format styles for a date interval:
この例は、いろいろなDate.FormatStyle.Symbol.Hour書式設定スタイルをある日付間隔に対して示します:
iflet today =Calendar.current.date(byAdding: .day, value: -140, to: Date()),let sevenDaysBeforeToday =Calendar.current.date(byAdding: .day, value: -7, to: today) {// Create a Range<Date>.let weekBefore = sevenDaysBeforeToday..<todayprint(weekBefore.formatted(.interval.minute()))print(weekBefore.formatted(.interval.day().minute().hour()))print(weekBefore.formatted(.interval.day().month().minute().hour(.defaultDigitsNoAMPM)))print(weekBefore.formatted(.interval.day().month().minute().hour(.conversationalDefaultDigits(amPM: .wide))))print(weekBefore.formatted(.interval.day().month().minute().hour(.conversationalDefaultDigits(amPM: .narrow))))}// 2/5/2021, 9 – 2/12/2021, 9// 5, 7:09 AM – 12, 7:09 AM// Feb 5, 07:09 – Feb 12, 07:09// Feb 5, 7:09 AM – Feb 12, 7:09 AM// Feb 5, 7:09 a – Feb 12, 7:09 a
See Also
参照
Modifying Date Interval Format Styles
日付間隔書式設定スタイルを修正する