distantPast
Creates and returns a Date value representing a date in the distant past.
- iOS
- 8.0+
- macOS
- 10.10+
- tvOS
- 9.0+
- watchOS
- 2.0+
static let distantPast: Date
The distant past is in terms of centuries.
Creates and returns a Date value representing a date in the distant past.
static let distantPast: Date
The distant past is in terms of centuries.
import FoundationEssentials
struct Date
Date
represents a single point in time.
init()
Returns a Date
initialized to the current date and time.
init<T>(_ value: T.ParseInput, strategy: T) throws where T : ParseStrategy, T.ParseOutput == Date
init<T, Value>(_ value: Value, strategy: T) throws where T : ParseStrategy, Value : StringProtocol, T.ParseInput == String, T.ParseOutput == Date
init(from decoder: any Decoder) throws
init(timeInterval: TimeInterval, since date: Date)
Returns a Date
initialized relative to another given date by a given number of seconds.
init(timeIntervalSince1970: TimeInterval)
Returns a Date
initialized relative to 00:00:00 UTC on 1 January 1970 by a given number of seconds.
init(timeIntervalSinceNow: TimeInterval)
Returns a Date
initialized relative to the current date and time by a given number of seconds.
init(timeIntervalSinceReferenceDate ti: TimeInterval)
Returns a Date
initialized relative to 00:00:00 UTC on 1 January 2001 by a given number of seconds.
static let distantFuture: Date
Creates and returns a Date value representing a date in the distant future.
static var now: Date { get }
Returns a Date
initialized to the current date and time.
static let timeIntervalBetween1970AndReferenceDate: TimeInterval
The number of seconds from 1 January 1970 to the reference date, 1 January 2001.
static var timeIntervalSinceReferenceDate: TimeInterval { get }
The interval between 00:00:00 UTC on 1 January 2001 and the current date and time.
static let validCalendarRange: ClosedRange<Date>
var capped: Date { get }
var customMirror: Mirror { get }
var debugDescription: String { get }
var description: String { get }
A string representation of the date object (read-only). The representation is useful for debugging only. There are a number of options to acquire a formatted string for a date including: date formatters (see NSDateFormatter and Data Formatting Guide), and the Date
function description(locale:)
.
var isValidForEnumeration: Bool { get }
var nextDown: Date { get }
var nextUp: Date { get }
var timeIntervalSince1970: TimeInterval { get }
The interval between the date object and 00:00:00 UTC on 1 January 1970.
var timeIntervalSinceNow: TimeInterval { get }
The time interval between the date and the current date and time.
var timeIntervalSinceReferenceDate: TimeInterval { get }
Returns the interval between the date object and 00:00:00 UTC on 1 January 2001.
static func + (lhs: Date, rhs: TimeInterval) -> Date
Returns a Date
with a specified amount of time added to it.
static func += (lhs: inout Date, rhs: TimeInterval)
Add a TimeInterval
to a Date
.
static func - (lhs: Date, rhs: TimeInterval) -> Date
Returns a Date
with a specified amount of time subtracted from it.
static func -= (lhs: inout Date, rhs: TimeInterval)
Subtract a TimeInterval
from a Date
.
static func < (lhs: Date, rhs: Date) -> Bool
Returns true if the left hand Date
is earlier in time than the right hand Date
.
static func == (lhs: Date, rhs: Date) -> Bool
Returns true if the two Date
values represent the same point in time.
static func > (lhs: Date, rhs: Date) -> Bool
Returns true if the left hand Date
is later in time than the right hand Date
.
func ISO8601Format(_ style: Date.ISO8601FormatStyle = .init()) -> String
mutating func addTimeInterval(_ timeInterval: TimeInterval)
Add a TimeInterval
to this Date
.
func addingTimeInterval(_ timeInterval: TimeInterval) -> Date
Return a new Date
by adding a TimeInterval
to this Date
.
func advanced(by n: TimeInterval) -> Date
func compare(_ other: Date) -> ComparisonResult
Compare two Date
values.
func description(with locale: Locale?) -> String
Returns a string representation of the receiver using the given locale.
func distance(to other: Date) -> TimeInterval
func encode(to encoder: any Encoder) throws
func formatted<F>(_ format: F) -> F.FormatOutput where F : FormatStyle, F.FormatInput == Date
func hash(into hasher: inout Hasher)
func timeIntervalSince(_ date: Date) -> TimeInterval
Returns the interval between the receiver and another given date.
struct ISO8601FormatStyle
Options for generating and parsing string representations of dates following the ISO 8601 standard.
typealias Stride = TimeInterval