Date formats
📆

Date formats

Overview

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.

đź’ˇ
If you are editing data with Excel, be aware that Excel can (and does) modify date formats, even if they look unchanged in your spreadsheet. What you see in the spreadsheet may not be what is actually stored. If you are repeatedly seeing date format errors, open your data file with a text editor such as Notepad and examine how your dates are being stored and passed to FIA.

Date formats

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

Any single-character date separator is allowable. Typical values are '-' or '/'.

Sample date formats

The following table lists some allowable dates and their 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
05132013
%m%d%Y
20130515
%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.

However, 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:

  1. Any formats supplied in  are applied first to the corresponding files;
  2. SecurityDateFormat, PortfolioDateFormat, YieldCurveDateFormat, FXDateFormat

  3. Next, DateFormat  is applied to any files that have not had a custom format applied;
  4. If  DateFormat has not been supplied, the default format is applied to any remaining files.

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. In this case, 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. In this case,

  • 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. In this case,

  • 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