- Declaration and initialization
- Properties available for the dates
- Range of dates
Date (Type of variable)
In french: Date
type is used to easily handle the dates. This type is used to manage the conversions almost automatically (StringToDate
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.
- 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.
StartDate is Date = 1205
EndDate is Date = "20011231" // 31/12/2001
TodaysDate is Date = DateSys()
Declaration and initialization
A Date variable can be initialized with a value whose type is:
- 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
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:
|Year||Returns or modifies the year of the specified date (in integer format).|
|Day||Returns or modifies the day of the specified date (in integer format).|
|Month||Returns 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
The Date type allows you to manage the dates included between 01/01/0001 and 12/31/9999.
Unit examples (WINDEV Mobile): Management of dates
[ + ]
Using the Date type and the WLanguage functions for handling dates.
This page is also available for…