Skip to main content

YEAR

Use the YEAR function to return the year from a Date or Date/Time. The year is a number ranging from 1000 to 9999.

Use

YEAR( date )
Returns the year of a date or date/time value.

ParameterRequiredDescription
dateYesthe date or date/time that contains the year to return

ReturnsNumber

Examples

Generating a Standardized Reference Code (Variable Update)

You can use the YEAR function in a Variable Update formula to create a unique identifier for each approval run that includes the current calendar year.

  • Scenario: A procurement team wants every purchase request to have a reference ID in the format "REQ-[Year]-[RunNumber]" (e.g., "REQ-2024-105").
  • Formula: CONCAT("REQ-", TEXT(YEAR(TODAY())), "-", TEXT(@prop.RunNumber))
  • Logic:
    • TODAY(): Retrieves the current system date.
    • YEAR(...): Extracts the year (e.g., 2024) from that date.
    • TEXT(...): Converts the numeric year and the run number into the Text data type so they can be joined together.
    • CONCAT(...): Joins the literal text "REQ-", the year, and the run number into a single string.
  • Result: The variable is updated with a clearly labeled, year-specific code that is useful for long-term auditing and reporting.

Validating Minimum Age Requirements (Output Validation)

In an Output Validation formula, the YEAR function can be used to perform logical checks on user-submitted dates to ensure they meet business rules, such as age restrictions.

  • Scenario: An HR onboarding form requires that a new hire must be at least 18 years old based on their submitted DateOfBirth.
  • Formula: ASSERT(YEAR(TODAY()) - YEAR(this) >= 18, "The applicant must be 18 years or older.")
  • Logic:
    • YEAR(TODAY()): Finds the current year.
    • YEAR(this): Extracts the year from the date the user entered into the birth date field.
    • Comparison: Subtracts the birth year from the current year and checks if the result is greater than or equal to 18.
  • Result: If the difference between the years is less than 18, the ASSERT function returns FALSE and displays the custom error message, preventing the user from submitting the form.