Skip to content

Instance Method

addingTimeInterval(_:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Creates a new date value by adding a time interval to this date.
func addingTimeInterval(_ timeInterval: TimeInterval) -> Date

Parameters

timeInterval

The value to add, in seconds.

Return Value

A new date value calculated by adding a time interval to this 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. That will take into account complexities like daylight saving time, months with different numbers of days, and more.