Converts a date string to its integer components
| Call | |
| #include <vv_sys.h> | |
| int date_tonums(date_stp, dayp, monthp, yearp, format_stp) | |
|
UCHAR *date_stp |
Date string to be converted |
| int *dayp | Pointer to variable to hold number of days |
| int *monthp | Pointer to variable to hold number of months |
| int *yearp | Pointer to variable to hold number of years |
| UCHAR *format_stp | Pointer to date format string |
| Description of Parameters
format_stp: Specify SYSDATEFMT (the global system date format), US_DATE ("MM/DD/YY"), EURO_DATE ("DD/MM/YY"), or your own date format string. A date format string is composed of the following characters: |
|
| D | Represents numeric day (i.e., 22). There can only be 2 Ds in the string. |
| M | Represents numeric month (i.e., 12). There can only be 2 Ms in the string. |
| S | Represents the string month (i.e., Mar or March depending on the number of Ss). There must be at least three Ss in the string so that the month can be uniquely specified. |
| Y | Represents the numeric year. There can be 2 or 4 Ys in the string. |
| Any other character, including spaces, may be used as separators between the components. The separators are optional. | |
| Returns | |
| 1 | The date string was successfully converted to its integer components |
| 0 | The date could not be converted because it is an invalid date |
| Description
The date string may contain only digits (0-9), characters from the recognized months, blanks, and separators according to the specified format string. date_tonums() parses the date string into the three sub-strings defined by the format string. These sub-strings are converted to integer values and then assigned to the variables day, month, and year according to the format string. If the year is less than 100, it is assumed to be a two-digit representation of the year (i.e., 92 for 1992) and the year is adjusted by the global variable CENTURYBREAK. The integer components of the date are checked to make sure they represent a valid date (i.e., the month variable must range from 1-12 and the day variable cannot exceed the number of days in the month). Specified month strings must be unique. Therefore, "J" and "JU" are illegal, but "JUN" is accepted as June. |
|
| Related Functions | |
| Cautions
Pointers to the day, month, and year variables are expected as arguments. An invalid date (zero return) is not considered a fatal error. VV_ERR does not get set; therefore, the VCS error reporting system does not report this condition. The passed date must match the format string. |
|