Skip to main content

Datetime: Date Parts

Extract a single integer component from a Date, DateTime, or Time value. Time-only parts (Hour, Minute, Second) require a DateTime or Time input; date-only parts (Year, Month, Day, Weekday, DayOfYear) require a Date or DateTime input. Mismatched part / input combinations fail the step.

Example
Part: Year → Date(2024-06-15) → 2024
Part: Month → Date(2024-06-15) → 6
Part: Weekday → Date(2024-06-15) → 6 (Saturday — ISO 8601)
Part: DayOfYear → Date(2024-06-15) → 167
Part: Hour → DateTime(2024-06-15T14:30Z) → 14

Parameters

PartREQUIRED

Which component to extract:

  • Year, Month, Day — calendar parts.
  • Hour, Minute, Second — time-of-day parts.
  • Weekday — day of the week, 1 (Monday) through 7 (Sunday), ISO 8601.
  • DayOfYear — ordinal day of the year, 1 through 366.

Defaults to Year.

Input

DateREQUIRED
A Date, DateTime, or Time value.

Output

Number
The extracted component as an integer.