isSameMonth
Modified on Tue, 22 Aug 2023
Description
Use this function to check if two given dates fall within the same month and year. It returns true if the two dates are in the same month and year, and false otherwise.
Syntax
isSameMonth(dateLeft, dateRight)
Returns
Return Value | Description |
---|---|
True/False | Returns true if the two dates are in the same month and year, otherwise false. |
Sample
Example | Result | Description |
---|---|---|
isSameMonth(2023-08-14, 2023-08-21) | true | Both dates, August 14th, 2023, and August 21st, 2023, are in the same month and year, so the function returns true. |
isSameMonth(2023-08-14, 2023-09-05) | false | The two dates are in different months (August and September) and therefore not in the same month and year, so 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