Structure
DateComponents
A date or time specified in terms of units (such as year, month, day, hour, and minute) to be evaluated in a calendar system and time zone.
--按单元(如年、月、日、小时和分钟)指定的要在日历系统和时区中计算的日期或时间。
Declaration --声明
struct DateComponents
Overview --概览
DateComponents
encapsulates the components of a date in an extendable, structured manner.
--DateComponents以可扩展的结构化方式封装日期的组件。
It is used to specify a date by providing the temporal components that make up a date and time in a particular calendar: hour, minutes, seconds, day, month, year, and so on. It can also be used to specify a duration of time, for example, 5 hours and 16 minutes. A DateComponents
is not required to define all the component fields.
--它通过提供组成特定日历中的日期和时间的时态组件来指定日期:小时、分钟、秒、日、月、年等等。它还可以用于指定持续时间,例如,5小时16分钟。定义DateComponents时,不需要定义它的所有组件字段。
When a new instance of DateComponents
is created, the date components are set to nil
.
--当创建DateComponents的新实例时,日期组件被设置为nil。
Topics --专题
Initializing Date Components --初始化日期组件
Initializes a date components value, optionally specifying values for its fields.
--初始化日期组件值,可选地为其字段指定值。
The calendar used to interpret the ot