isSameYear
Modified on Tue, 22 Aug 2023
Description
Use this function to check if two given dates fall within the same year. It returns true if the two dates are in the same year, and false otherwise.
Syntax
isSameYear(dateLeft, dateRight)
Returns
Return Value | Description |
---|---|
True/False | Returns true if the two dates are in the same year, otherwise false. |
Sample
Example | Result | Description |
---|---|---|
isSameYear(2023-08-14, 2023-12-25) | true | Both dates, August 14th, 2023, and December 25th, 2023, fall within the same year (2023), so the function returns true. |
isSameYear(2023-08-14, 2024-09-21) | false | The two dates are in different years (2023 and 2024), so they are not in the same year, and the function returns false. |
To view all the Date functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article