Description
The function year
extracts the year from a given date and returns it. It is useful for analyzing date values or working with other time-related data.
Syntax
year(date)
Arguments
Argument | Description |
---|---|
date | A date value or a text string representing a date. The function attempts to extract the year from this date. |
Return Types
The function returns the year as a number.
Examples
Formula | Result |
---|---|
year("2021/06/21") | 2021 |
year("1999-12-31") | 1999 |
year(today) | Returns the current year based on today's date. |
Notes
- The function only works if the parameter is a valid date or a valid date string. Invalid inputs may result in errors.
- This function can be used in combination with other date functions to perform more complex calculations.
Comments
0 comments
Please sign in to leave a comment.