Skip to content

Operator

+=(_:_:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Adds a time interval to a date.
static func += (lhs: inout Date, rhs: TimeInterval)

Parameters

lhs

A date.

rhs

A TimeInterval to add to the date.

Discussion

Warning

This only adjusts an absolute value. If you wish to add calendrical concepts like hours, days, months then you must use a Calendar. This takes into account complexities like daylight saving time, months with different numbers of days, and more.