<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCalendar/components(in:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCalendar(im)componentsInTimeZone:fromDate:"
  },
  "title" : "components(in:from:)"
}
-->

# components(in:from:)

Returns all the date components of a date, as if in a given time zone (instead of the receiving calendar’s time zone).

```
func components(in timezone: TimeZone, from date: Date) -> DateComponents
```

## Parameters

`timezone`

The time zone to use when returning the components. This value overrides the time zone of the receiving `NSCalendar`.

`date`

The date for which to perform the calculation.

## Return Value

An `NSDateComponents` object containing all the components from the given date, calculated using the given time zone.

## Discussion

If you want “date information in a given time zone” for the purpose to displaying it, you should use [`DateFormatter`](/documentation/Foundation/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)