<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Calendar/dateComponents(_:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation8CalendarV14dateComponents_4fromAA04DateD0VShyAC9ComponentOG_AA0F0VtF"
  },
  "title" : "dateComponents(_:from:)"
}
-->

# dateComponents(_:from:)

Returns all the date components of a date, using the calendar time zone.

```
func dateComponents(_ components: Set<Calendar.Component>, from date: Date) -> DateComponents
```

## Parameters

`components`

The components to return.

`date`

The `Date` to use.

## Return Value

The date components of the specified date.

## Discussion

> Note:
> If you want “date information in a given time zone” in order to display it, you should use `DateFormatter` to format the date.

---

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)