---
title: Calendar.Component
framework: foundation
role: symbol
role_heading: Enumeration
path: foundation/calendar/component
---

# Calendar.Component

An enumeration for the various components of a calendar date.

## Declaration

```swift
enum Component
```

## Overview

Overview You use one or more Calendar.Component values with the component(_:from:) or dateComponents(_:from:) methods to specify parts to extract from a given Date. The following code listing shows how to use the year, month, and day components to get the corresponding units of the current Gregorian calendar date as a DateComponents instance. let myCalendar = Calendar(identifier: .gregorian) let ymd = myCalendar.dateComponents([.year, .month, .day], from: Date())

## Topics

### Specifying Years and Months

- [Calendar.Component.era](foundation/calendar/component/era.md)
- [Calendar.Component.year](foundation/calendar/component/year.md)
- [Calendar.Component.yearForWeekOfYear](foundation/calendar/component/yearforweekofyear.md)
- [Calendar.Component.quarter](foundation/calendar/component/quarter.md)
- [Calendar.Component.month](foundation/calendar/component/month.md)

### Specifying Weeks and Days

- [Calendar.Component.weekOfYear](foundation/calendar/component/weekofyear.md)
- [Calendar.Component.weekOfMonth](foundation/calendar/component/weekofmonth.md)
- [Calendar.Component.weekday](foundation/calendar/component/weekday.md)
- [Calendar.Component.weekdayOrdinal](foundation/calendar/component/weekdayordinal.md)
- [Calendar.Component.day](foundation/calendar/component/day.md)

### Specifying Hours, Minutes, and Seconds

- [Calendar.Component.hour](foundation/calendar/component/hour.md)
- [Calendar.Component.minute](foundation/calendar/component/minute.md)
- [Calendar.Component.second](foundation/calendar/component/second.md)
- [Calendar.Component.nanosecond](foundation/calendar/component/nanosecond.md)

### Specifying Calendars and Time Zones

- [Calendar.Component.calendar](foundation/calendar/component/calendar.md)
- [Calendar.Component.timeZone](foundation/calendar/component/timezone.md)

### Enumeration Cases

- [Calendar.Component.dayOfYear](foundation/calendar/component/dayofyear.md)
- [Calendar.Component.isLeapMonth](foundation/calendar/component/isleapmonth.md)
- [Calendar.Component.isRepeatedDay](foundation/calendar/component/isrepeatedday.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Extracting Components

- [date(_:matchesComponents:)](foundation/calendar/date(_:matchescomponents:).md)
- [component(_:from:)](foundation/calendar/component(_:from:).md)
- [dateComponents(_:from:)](foundation/calendar/datecomponents(_:from:).md)
- [dateComponents(_:from:to:)](foundation/calendar/datecomponents(_:from:to:)-2kcg.md)
- [dateComponents(_:from:to:)](foundation/calendar/datecomponents(_:from:to:)-5g20t.md)
- [dateComponents(in:from:)](foundation/calendar/datecomponents(in:from:).md)
