|
|
|
|
|
- Declaration and initialization
- Properties available for the dates
- Date ranges
Date (Variable type) In french: Date
The Date type is used to easily manipulate dates. This type converts dates almost automatically ( StringToDate, DateToString, IntegerToDate, DateToInteger, etc.). This type can be used: - to get and manipulate HFSQL items in Date format.
- to get and manipulate Date Edit controls.
- in the WLanguage date management functions.
- to perform calculations involving dates (subtraction, addition, etc.). For more details, see Operations available using the Date type.
Remarks: - Several properties can be used with the Date type, to retrieve only 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()
Syntax
<Variable name> is Date = <Value> OR
<Variable name> is Date <Variable name> = <Value>
<Variable name>: Name of the variable to declare. When several variables of the same type are declared and initialized on the same line, only the last variable is initialized. <Value>: Variable initialization value (See Remarks). Remarks Declaration and initialization A Date variable can be initialized with a value of one of the following types: - Date
- DateTime: only the date will be taken into account.
- 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 with dates: | | Year | Returns or modifies an integer representing the year of the specified date. | Day | Returns or modifies an integer representing the day of the specified date. | Month | Returns or modifies an integer representing the month of the specified date. |
For more details on the possible operations on dates (addition, subtraction, comparison), see Operations available using 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--
Date ranges The Date type is used to manipulate dates between 01/01/0001 and 12/31/9999.
Related Examples:
|
Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|