# Date Parsing

Description | Separators | Parsing Years | Monthly, Bi-Monthly, and Daily Data | Weekly Data | Quarterly Data | See Also

## Description

Draco can import a variety of textual date formats into a worksheet. The help page on DateObjects describes the different time periods that the software understands. The software tries to accommodate many date format possibilities, as described below.

## Separators

The software automagically splits date strings into components using a collection of possible separators. The following separators are considered valid:

<Space> or <Tab> | Whitespaces
, | Comma
: | Colon
/ | Forward Slash
- | Dash

Sequential separators are treated as a single separator.

## Parsing Years

Draco always assumes that years are specified in complete form. In other words, the year 1911 must be specified as "1911." Specification as "11" will result in the software assuming the year 11 A.D.
To determine the specified year, the software first attempts to identify all components that can be successfully converted to integers. If only one such component exists in the date string, it is assumed to be the year. If this test is inconclusive, it attempts to identify date components exceeding 52 (weeks per year). Any number exceeding 52 or less than 0 are assumed to be years. If this test also proves inconclusive, the last component of the date string is assumed to be the year.

## Daily, Monthly, and Bi-Monthly Data

Daily and monthly data must be specified in complete form as well. For example, daily data must include the day, month, and year in its specification. Valid formats include English-readable dates (April 23, 2005) or numerically specified dates (4/23/2005, 4-23-2005, etc.). Draco defaults to the American-specific date order by default (month/day/year), but this option can be changed in the code by changing the `DateObject.FMT_DAY_FIRST` and `DateObject.FMT_MONTH_FIRST` flags.
Monthly data is specified similarly by excluding the day in the date string. For example, both an English-readable (April 2005) or a numerical (4/2005) format are acceptable.
Bi-monthly data provides for two acceptable formats. The first assumes that the first digit in the text string designates the month half. For example, the first and second halves of April, 2005, would be 1/4/2005 and 2/4/2005 respectively. Alternatively, the half can be specified using a decimal after the numerical month. Again, the first and second halves of April, 2005, would be 4.1/2005 and 4.2/2005.

## Weekly Data

Weekly data is simply specified by the week and the year. Because the year is always determined first, the week will always be the remaining date component. For example, week 37 of 1979 may be specified as either 37/1979 or 1979/37, although the second case only works because the year exceeds 52, as explained earlier. Other separators are also acceptable, including 37:1979, 37-1979, or any others using the proper separator characters.

## Quarterly Data

Quarterly data is specified by the quarter and the year. Because the year is always determined first, the quarter will always be the remaining date component. The quarter component can be accompanied by text as well; for example, Q2/1989 is a valid quarter designation. Other separators are also acceptable, including Q2:1989, Q2 1989, or any others using the proper separator characters.

## See Also

DateObjects

Copyright © 2007 Approximatrix, LLC
Text licensed under the Creative Commons Attribution-Share Alike 3.0 License
DracoTM and the Approximatrix logo are trademarks of Approximatrix, LLC
Other trademarks are property of their respective owners