PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Addition
  • Subtraction
  • Comparison
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The following operations are available for the following types of variables: Date, Time, DateTime and Duration:
  • addition
  • subtraction
  • comparison
Note: Several WLanguage functions can be used to handle the dates and times (see the functions for managing the dates and times).
Versions 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Addition
The addition operations performed between the Date, Time, DateTime and Duration variables are presented in the table below. This table presents the type of result for each combination:
Added type
DateTimeDateTimeDuration
DateConcatenation of the elements into a stringConcatenation of the elements into a string. This string can be used by DateTimeDifferenceConcatenation of the elements into a stringDate variable (Time part ignored)
TimeConcatenation of the elements into a stringConcatenation of the elements into a stringConcatenation of the elements into a stringTime variable (Date part ignored)
DateTimeConcatenation of the elements into a stringConcatenation of the elements into a stringConcatenation of the elements into a stringDateTime variable
DurationDate variableTime variableDateTime variableDuration variable
// Add a DateTime variable and a Time variable
StartDateTime is DateTime = "200112051530"
EndDateTime is DateTime = "200112051730"
ConferenceDuration is Duration = EndDateTime - StartDateTime

AdditionalTime is Time = "0330"
FinalDateTime is DateTime
FinalDateTime = ConferenceDuration + AdditionalTime
// Add a DateTime variable and a Duration variable
dtMyDate is DateTime = DateSys() + TimeSys()
dtMyResultDate is DateTime

Trace("Start DateTime: " + dtMyDate)

StartTime is Time = "0117"
EndTime is Time = "2353"  
duMyDuration is Duration = EndTime - StartTime
Trace("Duration in hours: " + NumToString(duMyDuration..InHours) + "h")

dtMyResultDate = dtMaDate + duMyDuration
Trace("DateTime added to a duration: " + dtMyResultDate)
Subtraction
The subtraction operations performed between the Date, Time, DateTime and Duration variables are presented in the table below. This table presents the type of result for each combination:
Subtracted type
DateTimeDateTimeDuration
DateDuration variableErrorErrorDate variable
TimeErrorDuration variableErrorTime variable
DateTimeErrorErrorDuration variableDateTime variable
DurationErrorErrorErrorDuration variable
StartDateTime is DateTime = "200112051530"
EndDateTime is DateTime = "200112071730"
ConferenceDuration is Duration = EndDateTime - StartDateTime
Comparison
The comparison operators (=, <>, <, >, <=, >=) used between the Date, Time, DateTime and Duration variables are presented in the table below. For each combination this table shows if the comparison is possible.
Compared type
DateTimeDateTimeDuration
DatePossibleErrorPossible (Time part ignored)Error
TimeErrorPossiblePossible (Date part ignored)Error
DateTimePossible (Time part ignored)Possible (Date part ignored)PossibleError
DurationErrorErrorErrorPossible
StartDateTime is DateTime = "200112051530"
EndDateTime is DateTime = "200115051730"
IF EndDateTime > StartDateTime THEN
        Info("The dates are valid")
END
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment