Date
public extension Date
-
Returns a random date within the specified date range.
Declaration
Swift
static func random(in range: Range<Date>) -> Date -
Returns a random date within the specified date range.
Declaration
Swift
static func random(in range: ClosedRange<Date>) -> Date -
Era in current timezone & calendar.
Declaration
Swift
var era: Int { get } -
Year in current timezone & calendar.
Declaration
Swift
var year: Int { get } -
Month in current timezone & calendar.
Declaration
Swift
var month: Int { get } -
Day in current timezone & calendar.
Declaration
Swift
var day: Int { get } -
Hour in current timezone & calendar.
Declaration
Swift
var hour: Int { get } -
Minute in current timezone & calendar.
Declaration
Swift
var minute: Int { get } -
Second in current timezone & calendar.
Declaration
Swift
var second: Int { get } -
Weekday in current timezone & calendar.
Declaration
Swift
var weekday: Int { get } -
WeekdayOrdinal in current timezone & calendar.
Declaration
Swift
var weekdayOrdinal: Int { get } -
Quarter in current timezone & calendar.
Declaration
Swift
var quarter: Int { get } -
WeekOfMonth in current timezone & calendar.
Declaration
Swift
var weekOfMonth: Int { get } -
WeekOfYear in current timezone & calendar.
Declaration
Swift
var weekOfYear: Int { get } -
YearForWeekOfYear in current timezone & calendar.
Declaration
Swift
var yearForWeekOfYear: Int { get } -
Nanosecond in current timezone & calendar.
Declaration
Swift
var nanosecond: Int { get } -
Era in specified timezone & calendar.
Declaration
Swift
func era(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Year in specified timezone & calendar.
Declaration
Swift
func year(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Month in specified timezone & calendar.
Declaration
Swift
func month(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Day in specified timezone & calendar.
Declaration
Swift
func day(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Hour in specified timezone & calendar.
Declaration
Swift
func hour(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Minute in specified timezone & calendar.
Declaration
Swift
func minute(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Second in specified timezone & calendar.
Declaration
Swift
func second(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Weekday in specified timezone & calendar.
Declaration
Swift
func weekday(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
WeekdayOrdinal in specified timezone & calendar.
Declaration
Swift
func weekdayOrdinal(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Quarter in specified timezone & calendar.
Declaration
Swift
func quarter(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
WeekOfMonth in specified timezone & calendar.
Declaration
Swift
func weekOfMonth(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
WeekOfYear in specified timezone & calendar.
Declaration
Swift
func weekOfYear(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
YearForWeekOfYear in specified timezone & calendar.
Declaration
Swift
func yearForWeekOfYear(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Nanosecond in specified timezone & calendar.
Declaration
Swift
func nanosecond(in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Int -
Initialize a Date object by setting date components.
Declaration
Swift
init?(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, nanosecond: Int = 0, timeZone: TimeZone? = nil, calendar: Calendar? = nil) -
Returns a new date by setting date component.
Declaration
Swift
func setting(_ component: Calendar.Component, with newValue: Int, in timeZone: TimeZone? = nil, for calendar: Calendar? = nil) -> Date?
Date Extension Reference