Calculates the number of days between two dates.
// Calculates the number of days elapsed since 01/01/1998
nbDays is int
nbDays = DateDifference("19980101", Today())
// Displays the result
Info(nbDays + " days elapsed")
<Result> = DateDifference(<Start date> , <End date>)
Number of days elapsed between two dates. This number of days is the result of the following operation:
<End date> - <Start date>
The number of days is negative if <Start date> is after <End date>.
<Start date>: Character string or Date variable
Start date for the calculation in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
<End date>: Character string or Date variable
End date for the calculation in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
The validity of the dates passed as parameters is checked. A message is displayed if the date is invalid. You can check the validity of a date using DateValid
This function cannot be used to calculate the difference between two dates before October 14, 1582 (the change from the Julian to the Gregorian calendar will not be taken into account).
The date storage format allows you to store dates from 01/01/0001 to 12/31/9999.
Unit examples (WINDEV): Management of dates
[ + ]
Using the Date type of WLanguage and the functions for handling dates.
Business / UI classification: Neutral code