atodate - convert ASCII to date value
DATE atodate (sptr)
Atodate converts a string pointed to by sptr to a DATE value that is the number of days beginning with January 1, 1800. January 1, 1800, has a value of 1. This format allows accurate representation of birth dates, and also allows date comparison and date arithmetic.
Atodate first tries to convert sptr with the format returned by getfdate(C-3). If this fails, two standard input formats are tried. These have the form: nn[s]nn[s]nn[nn] and dd[s]mmm[s]yy[yy]. In either form, s is an optional separator character. Any punctuation character can be used, but the same character must be used in both places.
To correctly convert the first standard input format, nn[s]nn[s]nn[nn], the value returned by getforder(C-3) determines the order of month, day, and year values.
The second standard input format, dd[s]mmm[s]yy[yy], is used when a letter appears after two digits and an optional separator character. In this case, the abbreviated month names returned by getfamth(C-3) determine the month.
Trailing blanks or tabs are allowed, leading blanks or tabs are not.
getfdate(C-3), fatodate(C-3), getforder(C-3), getfamth(C-3)
C/Base Reference Manual Chapter 13, "Formatting Data Values"
If the string sptr does not contain a valid date format or the string contains an invalid date (such as 03/32/81), a zero value is returned, which is always an invalid DATE value. Atodate knows about the number of days in each month and about leap years and returns a zero value when the month, day or year is invalid.