Enumeration

NSDateComponentsFormatterUnitsStyle

Constants for specifying how to represent quantities of time.

Declaration

typedef enum NSDateComponentsFormatterUnitsStyle : NSInteger {
    ...
} NSDateComponentsFormatterUnitsStyle;

Overview

All date and time values are localized and formatted according to the current user’s language preferences.

The following table shows how the quantity of 9 hours, 41 minutes, and 30 seconds is displayed in the U.S. English locale for each style:

Style

Displayed result

NSDateComponentsFormatterUnitsStyleSpellOut

“nine hours, forty-one minutes, thirty seconds”

NSDateComponentsFormatterUnitsStyleFull

“9 hours, 41 minutes, 30 seconds”

NSDateComponentsFormatterUnitsStyleShort

“9 hr, 41 min, 30 sec”

NSDateComponentsFormatterUnitsStyleBrief

“9hr 41min 30sec”

NSDateComponentsFormatterUnitsStyleAbbreviated

“9h 41m 30s”

NSDateComponentsFormatterUnitsStylePositional

“9:31:30”

Topics

Styles

NSDateComponentsFormatterUnitsStyleSpellOut

A style that spells out the units and quantities of time.

NSDateComponentsFormatterUnitsStyleFull

A style that spells out the units of time, but not the quantities.

NSDateComponentsFormatterUnitsStyleShort

A style that uses a shortened spelling for units.

NSDateComponentsFormatterUnitsStyleBrief

A style that uses a shortened spelling for units of time that is shorter than NSDateComponentsFormatterUnitsStyleShort.

NSDateComponentsFormatterUnitsStyleAbbreviated

A style that uses the most abbreviated spelling for units of time.

NSDateComponentsFormatterUnitsStylePositional

A style that uses the position of a unit of time to identify its value.