firstdate(X)
Returns the date of the first day of the period specified by a date-related value.
Syntax
firstdate(X)
Input
Argument | Type | Description |
---|---|---|
X |
|
A scalar value or the name of a column containing date-related values Valid values can be of the form:
|
For more information, see Dates and time.
Return Value
Returns the integer value (in date form) corresponding to the first day of the period specified by a date-related value given as input.
- For a month value given as input, the date corresponding to the first day of the month is returned.
- For a quarter value given as input, the date corresponding to the first day of the quarter is returned.
- For a year value given as input, the date corresponding to the first day of the year is returned.
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 first day of the month
value in the column named month
:
<base table="pub.fin.fred2.bls.smsa"/> <willbe name="example" value="firstdate(month)" label="First Day`of Period"/> <colord cols="month,example"/>
For a month value of 10/78
(X
=197810), the result would be 10/01/78.
For a month value of 05/80
(X
=198005), the result would be 05/01/80.