month(X)

Returns the month portion of a date-related value.

Syntax

month(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
  • date+time

For more information, see Dates and time.

Return Value

Returns the integer value (e.g., 1=January, 2=February, etc.) corresponding to the month portion 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 month portion of the month value in the column named month:

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

For a month value of 07/76 (X=197607), the result would be 7.