<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/DateFeatureExtractor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents20DateFeatureExtractorV"
  },
  "title" : "DateFeatureExtractor"
}
-->

# DateFeatureExtractor

A time and date feature extractor.

```
struct DateFeatureExtractor<Scalar> where Scalar : BinaryFloatingPoint
```

## Overview

This transformer takes a <doc://com.apple.documentation/documentation/Foundation/Date> and extracts
floating-point feature values according to the features parameter. Every feature value is roughly between -0.5 and
0.5. All date calculations are based on a <doc://com.apple.documentation/documentation/Foundation/Calendar>,
which defaults to <doc://com.apple.documentation/documentation/Foundation/Calendar/current>.

## Topics

### Creating a data feature extractor

[`init(features: DateFeatures, calendar: Calendar)`](/documentation/CreateMLComponents/DateFeatureExtractor/init(features:calendar:))

Creates a date feature extractor.

### Applying a data feature extractor

[`func applied(to: Date, eventHandler: EventHandler?) -> [Scalar]`](/documentation/CreateMLComponents/DateFeatureExtractor/applied(to:eventHandler:))

Extracts features of a particular date.

### Inspecting a data feature extractor

[`let calendar: Calendar`](/documentation/CreateMLComponents/DateFeatureExtractor/calendar)

The calendar.

[`let features: DateFeatures`](/documentation/CreateMLComponents/DateFeatureExtractor/features)

The date and time features.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Transformer`](/documentation/CreateMLComponents/Transformer)

[`Escapable`](/documentation/Swift/Escapable)

[`Copyable`](/documentation/Swift/Copyable)

[`Decodable`](/documentation/Swift/Decodable)

[`Encodable`](/documentation/Swift/Encodable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)