Formats a date string for the given day, month, and year
| Call | |
| #include <vv_sys.h> | |
| int date_frnums(date_stp, day, month, year, format_stp) | |
|
UCHAR *date_stp |
String to hold formatted date |
| int day | Day |
| int month | Month |
| int year | Year |
| UCHAR *format_stp | Date format string for controlling format |
| 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 has been built successfully |
| 0 | Invalid date components were specified |
| Description
First, date_frnums() ensures that the components of the date are valid. Days must be greater than 0 and have a value appropriate for the given month. Leap years are taken into account. If the date components are valid, date_frnums() converts the integer values representing the day, month, and year to a string based on the specified format string. Leading zeros (if necessary) are added to format the date. If separators are present in the format string, they will be copied to the destination date string. |
|
| Related Functions | |
| Cautions
The string must be large enough to hold the formatted date string, including the separators and the null terminator '\0'. 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. |
|