Calculates the number of days between two dates
| Call | |
| #include <vv_sys.h> | |
| long date_diff(date1_stp, date2_stp, format_stp) | |
|
UCHAR *date1_stp |
First date string |
| UCHAR *date2_stp | Second date string |
| UCHAR *format_stp | 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 characters, including spaces, may be used as separators between the components. The separators are optional. | |
| Returns | |
| != 0L | A positive or negative long integer representing the difference in days between the two dates. A negative value indicates date2 is earlier than date1. |
| 0L | There is no difference in the dates. In the development libraries, if an error occurs converting the date strings to Julian values, VV_ERR is set to indicate that the date is invalid. |
| Description
date_diff() converts both calendar dates to Julian dates and finds the difference with the formula: difference = date2 - date1. The difference in dates is returned as a long integer. |
|
| Related Functions | |
| Cautions
Both dates must be consistent with the specified date format string. |
|