<!--
{
  "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/DateFeatures",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents12DateFeaturesV"
  },
  "title" : "DateFeatures"
}
-->

# DateFeatures

A set of date and time features.

```
struct DateFeatures
```

## Overview

The choice of features for a particular task depends on the relevance of different date and time components. For
example a dataset of weather data may require hour and day-of-year features, while a dataset of workout metrics may
require second, hour, and weekday features.

## Topics

### Features

[`static let day: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/day)

A feature representing the day within the month.

[`static let dayOfYear: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/dayOfYear)

A feature representing the day within the year.

[`static let hour: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/hour)

A feature representing the hour within the day.

[`static let minute: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/minute)

A feature representing the minute within the hour.

[`static let month: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/month)

A feature representing the month within the year.

[`static let second: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/second)

A feature representing the second within the minute.

[`static let weekOfMonth: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/weekOfMonth)

A feature representing the week within the month.

[`static let weekOfYear: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/weekOfYear)

A feature representing the week within the year.

[`static let weekday: DateFeatures`](/documentation/CreateMLComponents/DateFeatures/weekday)

A feature representing the weekday.

### Creating a date feature type

[`init(rawValue: Int)`](/documentation/CreateMLComponents/DateFeatures/init(rawValue:))

Creates a feature from a raw value.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

---

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)