isSameQuarter

Modified on Tue, 22 Aug 2023

Description

Use this function to check if two given dates fall within the same quarter and year. It returns true if the two dates are in the same quarter and year, and false otherwise.

Syntax

isSameQuarter(dateLeft, dateRight)

Returns

Return ValueDescription
True/FalseReturns true if the two dates are in the same quarter and year, otherwise false.

Sample

ExampleResultDescription
isSameQuarter(2023-08-14, 2023-09-21)trueBoth dates, August 14th, 2023, and September 21st, 2023, are in the same quarter (Q3) and year, so the function returns true.
isSameQuarter(2023-08-14, 2023-12-05)falseThe two dates are in different quarters (Q3 and Q4) and therefore not in the same quarter and year, so the function returns false.

To view all the Date functions, click here.

See Also