second
A second or count of seconds.
- iOS
- 8.0+
- macOS
- 10.9+
- tvOS
- 9.0+
- watchOS
- 2.0+
var second: Int? { get set }
A second or count of seconds.
var second: Int? { get set }
import FoundationEssentials
struct DateComponents
DateComponents
encapsulates the components of a date in an extendable, structured manner.
@frozen struct Int
A signed integer value type.
init(calendar: Calendar? = nil, timeZone: TimeZone? = nil, era: Int? = nil, year: Int? = nil, month: Int? = nil, day: Int? = nil, hour: Int? = nil, minute: Int? = nil, second: Int? = nil, nanosecond: Int? = nil, weekday: Int? = nil, weekdayOrdinal: Int? = nil, quarter: Int? = nil, weekOfMonth: Int? = nil, weekOfYear: Int? = nil, yearForWeekOfYear: Int? = nil)
Initialize a DateComponents
, optionally specifying values for its fields.
init?(component: Calendar.Component, value: Int)
init(from decoder: any Decoder) throws
var calendar: Calendar? { get set }
The Calendar
used to interpret the other values in this structure.
var customMirror: Mirror { get }
var date: Date? { get }
Returns a Date
calculated from the current components using the calendar
property.
var day: Int? { get set }
A day or count of days.
var dayOfYear: Int? { get set }
A day of the year. For example, in the Gregorian calendar, can go from 1 to 365 or 1 to 366 in leap years.
var debugDescription: String { get }
var description: String { get }
var era: Int? { get set }
An era or count of eras.
var hour: Int? { get set }
An hour or count of hours.
var isLeapMonth: Bool? { get set }
Set to true if these components represent a leap month.
var isValidDate: Bool { get }
Returns true if the combination of properties which have been set in the receiver is a date which exists in the calendar
property.
var minute: Int? { get set }
A minute or count of minutes.
var month: Int? { get set }
A month or count of months.
var nanosecond: Int? { get set }
A nanosecond or count of nanoseconds.
var quarter: Int? { get set }
A quarter or count of quarters.
var timeZone: TimeZone? { get set }
A time zone.
var week: Int? { get set }
var weekOfMonth: Int? { get set }
A week of the month or a count of weeks of the month.
var weekOfYear: Int? { get set }
A week of the year or count of the weeks of the year.
var weekday: Int? { get set }
A weekday or count of weekdays.
var weekdayOrdinal: Int? { get set }
A weekday ordinal or count of weekday ordinals. Weekday ordinal units represent the position of the weekday within the next larger calendar unit, such as the month. For example, 2 is the weekday ordinal unit for the second Friday of the month.
var year: Int? { get set }
A year or count of years.
var yearForWeekOfYear: Int? { get set }
The ISO 8601 week-numbering year of the receiver.
static func == (lhs: DateComponents, rhs: DateComponents) -> Bool
func encode(to encoder: any Encoder) throws
func hash(into hasher: inout Hasher)
func isValidDate(in calendar: Calendar) -> Bool
Returns true if the combination of properties which have been set in the receiver is a date which exists in the specified Calendar
.
mutating func setValue(_ value: Int?, for component: Calendar.Component)
Set the value of one of the properties, using an enumeration value instead of a property name.
func value(for component: Calendar.Component) -> Int?
Returns the value of one of the properties, using an enumeration value instead of a property name.