Command Reference : String and Date Function Reference
  
 
@datestr
String representation of a date number.
Syntax: @datestr(d[, fmt])
d: date number
fmt: (optional) date format string
Return: string
Convert the numeric date value, d, into a string representation of a date using the optional format string fmt. Date format syntax is outlined in “Date Formats”.
If a fmt is not provided, EViews will use the global default settings for the Month/Day order in dates to determine the ordering of days and months in the string.
Next, EViews examines the date values to be translated and looks for relevant time-of-day information. If there is relevant time-of-day information, EViews will extend the date format accordingly by adding relevant hours, minutes, and seconds information, in that order. Thus, if days are favored in the global default ordering, and relevant hours (but not minutes and seconds) information is present, EViews will use
"dd/mm/yyyy hh"
while if hours-minutes are present, the default format will be
"dd/mm/yyyy hh:mi"
and so forth.
Examples
Consider the d date number value 730088 (midnight, December 1, 1999).
Then
@datestr(730088, "mm/dd/yy")
will return “12/1/99”,
@datestr(730088, "DD/mm/yyyy")
will return “01/12/1999”, and
@datestr(730088, "Month dd, yyyy")
will return “December 1, 1999”, and
@datestr(730088, "w")
will produce the string “3”, representing the weekday number for December 1, 1999.
You may use text to delimit the date format components,
@datestr(730088, "yyyy:q")
@datestr(730088, "yyyy[q]q")
produces “1999:4” and “1999q4”. Note the use of the square brackets to pass through the literal “q” string to the string output. If the workfile is quarterly, then
@datestr(730088, "yyyy[q]q")
also returns “1999q4” as the “f” will return the frequency delimiter from the active workfile page.
If DSER is a series containing date numbers,
alpha aser1 = @datestr(dser, "Month dd, yyyy")
produces the formatted date string for each observation in DSER in the workfile sample.
If DVEC is a vector containing date numbers,
svector avec = @datestr(dvec, "DD/mm/yyyy")
returns a svector containing strings with the day, month, and year, corresponding to each element of the DVEC vector.
Cross-references
See “Dates” and “Date Formats”for additional details on date numbers and date format strings.
See @strdate to obtain workfile date strings. See also @dateval for converting date strings to date numbers.