DateComponentsFormatter is an Apple Foundation type (DateComponentsFormatter in Swift, NSDateComponentsFormatter in Objective-C), that takes quantities of time and formats them as a localized, user-readable strings.
DateComponentsFormatter
(known as simply DateComponents
in swift, but as NSDateComponentsFormatter
in objective-c) is an Apple foundation type, that takes quantities of time and formats them as a localized, user-readable strings. It is used to display a length of time in the UI.
The date components formatter can be used with either a TimeInterval
(a Double
representation of the number of seconds) or a DateComponents
(a structure that represents a length of time in “units”, such as year, month, day, hour, and minute).
See also:
DateComponentsFormatter
documentation- Data Formatting in Apple Developer Documentation