FIA can parse a wide range of date formats. Date formats are constructed by appending a number of format specifiers, corresponding to the day, month and year fields of the supplied date, together with the field delimiters.
Formats correspond to those used by the C strptime function. The following formats are allowable:
Format | Example | Sample |
%d | Day of month (1-31) | 15 |
%m | Month number (1-12) | 2 |
%b | Month in abbreviated or full form | February, Feb |
%y | The year without century data (0-99). When a century is not otherwise specified, values in the range 69-99 refer to years in the twentieth century (1969-1999); values in the range 00-68 refer to years in the twenty-first century (2000-2068) | 45 |
%Y | The year, including century | 2015 |
Date format strings are constructed by aggregating the above format strings with the date delimiter. For instance, if your dates are in the dd-mm-yy format, set the format string to %d-%m-%y, using a hyphen as the delimiter.
The following table lists some example date format strings:
Date | Format |
15/05/2013 | %d/%m/%Y |
15/05/13 | %d/%m/%y |
05/15/2013 | %m/%d/%Y |
05-15-2013 | %m-%d-%Y |
05152003 | %m%d%Y |
20031505 | %Y%m%d |
15-May-13 | %d-%b-%y |
15-May-2013 | %d-%b-%Y |
Initially, all date formats have the default value %Y-%m-%d. This can be overridden as follows:
FIA allows you to specify a date format to be used for all files, a specific date format for each file, or any combination of the two. Formats are applied using the following schema:
- Any formats supplied in SecurityDateFormat, PortfolioDateFormat, YieldCurveDateFormat, FXDateFormat are applied first to the corresponding files.
- Next, format DateFormat is applied to any files that have not had a custom format applied.
- If DateFormat has not been supplied, the default format is applied to any remaining files.
Example | Setting | Result |
Example 1 | No date format strings set | All dates from all files will be read using the default format string %Y-%m-%d |
Example 2 | DateFormat is set to DEMO_STRING, no other format strings set | All dates in all files will be read and parsed using DEMO_STRING |
Example 3 | DateFormat is set to DEMO_STRING1, SecurityDateFormat is set to DEMO_STRING2. | All dates in the security file will be read and parsed using DEMO_STRING2, all dates in other files will be read and parsed using DEMO_STRING1 |
Example 4 | DateFormat is not set, SecurityDateFormat is set to DEMO_STRING1 | All dates in the security file will be read and parsed using DEMO_STRING1, all other dates will be read and parsed according to the default format string %Y-%m-%d |