ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / 
  • Declaration and initialization
  • Properties available for the dates
  • Range of dates
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
The Date type is used to easily handle the dates. This type is used to manage the conversions almost automatically (StringToDate, DateToString, IntegerToDate, DateToInteger, ...).
This type can be used:
  • to retrieve and handle the HFSQL items in Date format.
  • to retrieve and handle the Date edit controls.
  • in the WLanguage functions used to manage the dates.
  • to perform calculations on dates (difference, addition, ...). For more details, see Operations that can be performed on the Date type.
Remarks:
  • Several properties can be used with the Date type, to retrieve part of the date for example.
  • For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
StartDate is Date = 1205
EndDate is Date = "20011231"     // 31/12/2001
TodaysDate is Date = DateSys()
Remarks

Declaration and initialization

A Date variable can be initialized with a value whose type is:
  • Date
  • DateTime: only the date will be taken into account.
  • Character string, in YYYYMMDD format (YYYY: year, MM: Month, DD: Day)
  • Integer: the date will correspond to the number of days passed between January 1st 1800 and the specified date.
By default, a Date variable is initialized with today's date (system date). To define the default value assigned to the Date, Time and DateTime variables, use DateTimeByDefault.
Remark: You also have the ability to initialize a Date variable with the system date by using Now.

Properties available for the dates

The following properties can be used on the dates:
YearReturns or modifies the year of the specified date (in integer format).
DayReturns or modifies the day of the specified date (in integer format).
MonthReturns or modifies the month of the specified date (in integer format).
For more details on the possible operations on dates (add, subtract, compare), see Operations that can be performed on the Date type.
StartDate is Date = "20011201"
// Adds 5 years to the date
StartDate.Year += 5
// Modifies the month
StartDate.Month = 5
// Calculates the end (30 days later)
let EndDate = StartDate
EndDate.Month++
EndDate.Day--

Range of dates

The Date type allows you to manage the dates included between 01/01/0001 and 12/31/9999.
Remark: WLanguage functions and WLanguage properties make accurate calculations on dates from January 1st, 1583.
Related Examples:
Management of dates Unit examples (WEBDEV): Management of dates
[ + ] This example presents the use of the Date type of WLanguage and the use of the functions for handling the dates.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help