quarter(X)

Returns the quarter corresponding to a date-related value.

Syntax

quarter(X)

Input

Argument Type Description
X integer or decimal A scalar value or the name of a column containing date-related values
Valid values can be of the form:
  • date
  • month
  • quarter
  • date+time

For more information, see Dates and time .

Return Value

Returns the integer value (e.g., 1=first quarter, 2=second quarter, etc.) corresponding to the quarter of the date-related value given as input.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

In the Monthly Statewide Seasonally Adjusted Unemployment Statistics table (pub.fin.fred2.bls.smsa), you can create a computed column that displays an integer value corresponding to the quarter of the month value in the column named month:

<base table="pub.fin.fred2.bls.smsa" label="Example: quarter(X)"/>
<willbe name="example" value="quarter(month)" label="Quarter"/>
<colord cols="month,example"/>

For a month value of 10/76 (X=197610), the result would be 4. (October is in the fourth quarter.)