<!--
{
  "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(in:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation8CalendarV14dateComponents2in4fromAA04DateD0VAA8TimeZoneV_AA0G0VtF"
  },
  "title" : "dateComponents(in:from:)"
}
-->

# dateComponents(in:from:)

Returns all the date components of a date, as if in a given time zone (instead of the `Calendar` time zone).

```
func dateComponents(in timeZone: TimeZone, from date: Date) -> DateComponents
```

## Parameters

`timeZone`

The `TimeZone` to use.

`date`

The `Date` to use.

## Return Value

All components, calculated using the `Calendar` and `TimeZone`.

## Discussion

The time zone overrides the time zone of the `Calendar` for the purposes of this calculation.

> 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)