Skip to content

Instance Method

addTimeInterval(_:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Adds a time interval to this date.
mutating func addTimeInterval(_ timeInterval: TimeInterval)

Parameters

timeInterval

The value to add, in seconds.

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. That will take into account complexities like daylight saving time, months with different numbers of days, and more.