---
title: "getEra(_:yearForWeekOfYear:weekOfYear:weekday:from:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscalendar/getera(_:yearforweekofyear:weekofyear:weekday:from:)"
---

# getEra(_:yearForWeekOfYear:weekOfYear:weekday:from:)

Returns by reference the era, year, week of year, and weekday component values for a given date.

## Declaration

```swift
func getEra(_ eraValuePointer: UnsafeMutablePointer<Int>?, yearForWeekOfYear yearValuePointer: UnsafeMutablePointer<Int>?, weekOfYear weekValuePointer: UnsafeMutablePointer<Int>?, weekday weekdayValuePointer: UnsafeMutablePointer<Int>?, from date: Date)
```

## Parameters

- `eraValuePointer`: Upon return, contains the era of the given date.
- `yearValuePointer`: Upon return, contains the year of the given date.
- `weekValuePointer`: Upon return, contains the week of the given date.
- `weekdayValuePointer`: Upon return, contains the weekday of the given date.
- `date`: The date for which to perform the calculation.

## Discussion

Discussion Pass NULL to ignore any individual component parameter. This is a convenience method for getting the time components of a given date using components(_:from:)

## See Also

### Extracting Components

- [date(_:matchesComponents:)](foundation/nscalendar/date(_:matchescomponents:).md)
- [component(_:from:)](foundation/nscalendar/component(_:from:).md)
- [components(_:from:)](foundation/nscalendar/components(_:from:).md)
- [components(_:from:to:options:)](foundation/nscalendar/components(_:from:to:options:)-84y5w.md)
- [components(_:from:to:options:)](foundation/nscalendar/components(_:from:to:options:)-49lo8.md)
- [components(in:from:)](foundation/nscalendar/components(in:from:).md)
- [getEra(_:year:month:day:from:)](foundation/nscalendar/getera(_:year:month:day:from:).md)
- [getHour(_:minute:second:nanosecond:from:)](foundation/nscalendar/gethour(_:minute:second:nanosecond:from:).md)
