|
|
|
|
- Declaration and initialization
- Properties that can be used on the DateTime variables
- Interval of data
DateTime (Type of variable) In french: DateHeure
The DateTime type is used to easily handle a date and a time. The DateTime type can be used to perform calculations (subtraction, addition, ...) on the dates, times and durations. For more details, see Operations that can be performed on the DateTime type. Remarks: - Several properties can be used with the DateTime type, to retrieve the date or the time, a part of the date or a part of the time.
- For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
StartDate is DateTime = "200112311524" // 31/12/2001 at 15:24
Remarks Declaration and initialization - A DateTime variable can be initialized with a value of the following type:
- Date: the hours and the minutes will be initialized to 0.
- DateTime
- Character string, in the following format
- YYYYMMDD
- YYYYMMDDHH
- YYYYMMDDHHmm
- YYYYMMDDHHmmSS
- YYYYMMDDHHmmSSCC
- YYYYMMDDHHmmSSCCC
(YYYY: year, MM: month, DD: Day, HH: hour, mm: minutes, SS: seconds, CC: hundredths of a second, CCC: Thousandths of a second)
- By default, a DateTime variable is initialized with today's date (system date) and with the system time. To define the default value assigned to the Date, Time and DateTime variables, use DateTimeByDefault.
Remark: You also have the ability to initialize a DateTime variable with the system date and time by using Now. Properties that can be used on the DateTime variables | | Year | Returns or modifies the year of the specified date (in integer format). | Time | Returns or modifies the hour (in integer format). | Day | Returns or modifies the day of the specified date (in integer format). | Millisecond | Returns or modifies the number of milliseconds (in integer format). | Minute | Returns or modifies the number of minutes (in integer format). | Month | Returns or modifies the month of the specified date (in integer format). | Date | Returns or modifies the date of the DateTime variable (in date format). | Time | Returns or modifies the time of the DateTime variable (in time format). | Second | Returns or modifies the number of seconds (in integer format). |
StartDate is DateTime = "200112011530" // Adds 5 years to the date StartDate.Year += 5 // Modifies the month StartDate.Month = 5 // Displays the date Info("Date " + StartDate<§Date) // Displays the time Info("Time " + StartDate<§Time)
The DateTime type is used to manage data included between 01/01/0001 at 00:00 and 12/31/9999 at 23:59.
Related Examples:
|
Unit examples (WINDEV): Calculations on durations
[ + ] Calculations on dates and times with the WLanguage functions: - Calculate the duration between two moments (dates and times) - Calculate a sum of durations - Calculate an average of durations
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|