Swift makes date math straightforward with Calendar and DateComponents.
Calendar
DateComponents
Swift uses the Date type for date and time.
Date
Swift uses DateFormatter to turn Date objects into readable strings.
DateFormatter
Swift’s Foundation framework provides the Date class, making it straightforward to get the current date and time.
Foundation
Swift’s standard library, Foundation, provides DateFormatter for converting strings to Date objects and vice versa.