Date
struct Date : ReferenceConvertible, Comparable, Equatable
-
Convert date from UTC
Declaration
Swift
public var fromUTC: Date -
Convert date to UTC
Declaration
Swift
public var toUTC: Date -
Convert date to string with format specified
Declaration
Swift
public func toStringWithFormat(format: String) -> StringParameters
formatFormat string
Return Value
String with date conforming specified format
-
String with ISO date
Declaration
Swift
public var ISODate: String -
Stirng with ISO time
Declaration
Swift
public var ISOTime: String -
String with ISO date and time
Declaration
Swift
public var ISODateTime: String -
Checks for date is in today
Declaration
Swift
public var isToday: Bool -
Checks for date is in yesterday
Declaration
Swift
public var isYesterday: Bool -
Checks for date is in tomorrow
Declaration
Swift
public var isTomorrow: Bool -
Return number of days since now
Declaration
Swift
public var daysAgo: Int -
Number of days when self is earlier than argument
Declaration
Swift
public func daysEarlier(than date: Date) -> IntParameters
dateSource date
Return Value
Number of days, or 0 in case self is later than parameter
-
Returns most earlier date form self and parameter
Declaration
Swift
public func earlierDate(_ date: Date) -> DateParameters
dateSource date
Return Value
Most earlier date
-
Days between self and parameter using custom calendar
Declaration
Swift
public func days(from date: Date, calendar: Calendar? = nil) -> IntParameters
dateSource date
calendarCalendar instance (will used Calendar.autoupdatingCurrent when not specified)
Return Value
<#return value description#>
-
Weekday of the date
Declaration
Swift
public var weekday: Int -
Extract calendar component from the date
Declaration
Swift
public func component(_ component: Calendar.Component) -> IntParameters
componentComponent to extract
Return Value
Result value
-
Returns string with relative date information from now (today, yesterday, 2..6 days ago or date in short format)
Declaration
Swift
public func relative() -> StringParameters
dateDate to compare with
Return Value
Result string
-
Undocumented
Declaration
Swift
public static let minutesInAWeek = 24 * 60 * 7 -
Initializes Date from string and format
Declaration
Swift
public init?(fromString string: String, format: String) -
Initializes Date from string returned from an http response, according to several RFCs / ISO
Declaration
Swift
public init?(httpDateString: String) -
Converts Date to String
Declaration
Swift
public func toString(dateStyle: DateFormatter.Style = .medium, timeStyle: DateFormatter.Style = .medium) -> String -
Converts Date to String, with format
Declaration
Swift
public func toString(format: String) -> String -
Calculates how many days passed from now to date
Declaration
Swift
public func daysInBetweenDate(_ date: Date) -> Double -
Calculates how many hours passed from now to date
Declaration
Swift
public func hoursInBetweenDate(_ date: Date) -> Double -
Calculates how many minutes passed from now to date
Declaration
Swift
public func minutesInBetweenDate(_ date: Date) -> Double -
Calculates how many seconds passed from now to date
Declaration
Swift
public func secondsInBetweenDate(_ date: Date) -> Double -
Easy creation of time passed String. Can be Years, Months, days, hours, minutes or seconds
Declaration
Swift
public func timePassed() -> String -
Check if date is in future.
Declaration
Swift
public var isFuture: Bool -
Check if date is in past.
Declaration
Swift
public var isPast: Bool -
Check date if it is within this month.
Declaration
Swift
public var isThisMonth: Bool -
Check date if it is within this week.
Declaration
Swift
public var isThisWeek: Bool -
Get the era from the date
Declaration
Swift
public var era: Int -
Get the year from the date
Declaration
Swift
public var year: Int -
Get the month from the date
Declaration
Swift
public var month: Int -
Undocumented
Declaration
Swift
public var monthAsString: String -
Undocumented
Declaration
Swift
public var day: Int -
Get the hours from date
Declaration
Swift
public var hour: Int -
Get the minute from date
Declaration
Swift
public var minute: Int -
Get the second from the date
Declaration
Swift
public var second: Int -
Gets the nano second from the date
Declaration
Swift
public var nanosecond: Int -
Gets the international standard(ISO8601) representation of date
Declaration
Swift
public var iso8601: String
Date Extension Reference