---
title: zeroFormattingBehavior
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/datecomponentsformatter/zeroformattingbehavior-swift.property
---

# zeroFormattingBehavior

The formatting style for units whose value is 0.

## Declaration

```swift
var zeroFormattingBehavior: DateComponentsFormatter.ZeroFormattingBehavior { get set }
```

## Discussion

Discussion When the value for a particular unit is 0, the zero formatting behavior determines whether that value is retained or omitted from any resulting strings. For example, when the formatting behavior is dropTrailing, the value of one hour, ten minutes, and zero seconds would omit the mention of seconds. The default value of this property is default.

## See Also

### Configuring the Formatter Options

- [allowedUnits](foundation/datecomponentsformatter/allowedunits.md)
- [allowsFractionalUnits](foundation/datecomponentsformatter/allowsfractionalunits.md)
- [calendar](foundation/datecomponentsformatter/calendar.md)
- [collapsesLargestUnit](foundation/datecomponentsformatter/collapseslargestunit.md)
- [includesApproximationPhrase](foundation/datecomponentsformatter/includesapproximationphrase.md)
- [includesTimeRemainingPhrase](foundation/datecomponentsformatter/includestimeremainingphrase.md)
- [maximumUnitCount](foundation/datecomponentsformatter/maximumunitcount.md)
- [unitsStyle](foundation/datecomponentsformatter/unitsstyle-swift.property.md)
