<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DateComponentsFormatter/zeroFormattingBehavior-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDateComponentsFormatter(py)zeroFormattingBehavior"
  },
  "title" : "zeroFormattingBehavior"
}
-->

# zeroFormattingBehavior

The formatting style for units whose value is 0.

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

## 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`](/documentation/Foundation/DateComponentsFormatter/ZeroFormattingBehavior-swift.struct/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`](/documentation/Foundation/DateComponentsFormatter/ZeroFormattingBehavior-swift.struct/default).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)