ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
DateDifference (Function)
In french: DateDifference
Calculates the number of days between two dates.
Example
// Calculates the number of days elapsed since 01/01/1998
nbDays is int
nbDays = DateDifference("19980101", Today())
// Displays the result
Info(nbDays + " days elapsed")
Syntax
<Result> = DateDifference(<Start date> , <End date>)
<Result>: Integer
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).
Remarks
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.
WLanguage functions and WLanguage properties make accurate calculations on dates from January 1st, 1583.
Related Examples:
Management of dates Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video DateDiference
https://youtu.be/1cnd0XoKAdg

https://windevdesenvolvimento.blogspot.com/2019/01/dicas-1986-windev-data-25.html

amarildo
15 Jan. 2019

Last update: 06/22/2023

Send a report | Local help