ISYEAR
Checks if a date is within a specific year.
Description
Determines if a given date or an array of dates falls within a specified year. It can handle single date timestamps or arrays of dates, optionally extracting dates from objects.
Syntax
ISYEAR(dateitems, year, [key])
Arguments
dateitems
: A AnyDB date time ojbect (Unix timestamp (number)) or an array of Unix timestamps or objects containing timestamps.year
: The year (e.g., 2023) to check against.[key]
: (Optional) Ifdateitems
is an array of objects, this key specifies the property containing the Unix timestamp.
Example
ISYEAR(1678886400, 2023) → Returns TRUE (March 17, 2023).
ISYEAR([1678886400, 1640995200], 2023) → Returns [1678886400] (March 17, 2023 is in 2023, January 1, 2022 is not).
ISYEAR([{date: 1678886400}, {date: 1640995200}], 2023, "date") → Returns [{date: 1678886400}].
Usage Notes:
- The function uses Unix timestamps for date representation.
- If
dateitems
is a single number, it returnsTRUE
orFALSE
. - If
dateitems
is an array, it returns a filtered array containing only the dates that fall within the specified year. - If a
key
is provided anddateitems
is an array of objects, the function extracts the timestamp from the object using the specified key. - The function operates in UTC timezone.
- Year is a number representing the year.