20200714--iOS之DateComponents结构体,日期组件

DateComponents结构体封装了日期的各个组件,如年、月、日、小时和分钟等,用于在特定日历系统和时区中指定日期或时间。它可以表示日期,也可以表示时间间隔,并提供了初始化、验证、访问组件、比较和描述日期组件的方法。
摘要由CSDN通过智能技术生成

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        --初始化日期组件

init(calendar: Calendar?, timeZone: TimeZone?, era: Int?, year: Int?, month: Int?, day: Int?, hour: Int?, minute: Int?, second: Int?, nanosecond: Int?, weekday: Int?, weekdayOrdinal: Int?, quarter: Int?, weekOfMonth: Int?, weekOfYear: Int?, yearForWeekOfYear: Int?)

Initializes a date components value, optionally specifying values for its fields.

--初始化日期组件值,可选地为其字段指定值。

 

var calendar: Calendar?

The calendar used to interpret the ot

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值