PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Managing times
  • Managing durations
  • Operators available for hours
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
..Hour is used to:
  • Retrieve the time from a Time or DateTime variable, or the number of hours from a Duration variable.
  • Modify the time in a Time or DateTime variable, or the number of hours in a Duration variable.
  • Retrieve the time or the number of hours from a Date item (in "Date and Time" or "Duration" format) or from an Time item.
    WEBDEV - Browser code Not available.
  • Modify the time or the number of hours in a Date item (in "Date and Time" or "Duration" format) or in an Time item.
    WEBDEV - Browser code Not available.
Note: ..Hour is used to simplify the operations performed on times and durations (add one hour, etc.).
Reminder: The Date items are used to manage:
  • the simple dates "Year - Month - Day" (YYYYMMDD format)
  • the dates and times "Year - Month - Day - Hours - Minutes - Seconds - Milliseconds" (YYYYMMDDHHMMSSLLL format)
  • the durations "Number of days - Number of hours - Number of minutes - Number of seconds - Number of milliseconds" (+DHHMMSSLLL format)
Versions 16 and later
Universal Windows 10 App This property is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This property is now available for the Windows Phone applications.
Universal Windows 10 App This property is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This property is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This property is now available for the iPhone/iPad applications.
iPhone/iPad This property is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This property is now available in Windows Store Apps mode.
New in version 18
Universal Windows 10 App This property is now available in Windows Store Apps mode.
Universal Windows 10 App This property is now available in Windows Store Apps mode.
Versions 20 and later
WEBDEV - Browser code This property is now available in browser code for the Time, DateTime or Duration variables.
New in version 20
WEBDEV - Browser code This property is now available in browser code for the Time, DateTime or Duration variables.
WEBDEV - Browser code This property is now available in browser code for the Time, DateTime or Duration variables.
Versions 21 and later
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
Apple Watch This property is now available in Apple Watch mode.
Universal Windows 10 App This property is now available in Universal Windows 10 App mode.
Example
// Example on a variable
StartTime is Time = "1230"
// Add 10 hours
StartTime..Hour += 10   // StartTime corresponds to 22:30
StartTime..Hour += 10   // StartTime corresponds to 08:30
// Modify hours
StartTime..Hour = 10
// Example on an item
Day.StartTime = "1230"
// Add 10 hours
Day.StartTime..Hour += 10 // StartTime corresponds to 22:30
Day.StartTime..Hour += 10 // StartTime corresponds to 08:30
// Modify hours
Day.StartTime..Hour = 10
Syntax

Finding out the hour of a Time, DateTime or Duration variable Hide the details

<Result> = <Time used>..Hour
<Result>: Integer
Time on 2 digits.
<Time used>: Time, DateTime or Duration
Name of the Time, DateTime or Duration variable to use.

Modifying the time of a Time, DateTime or Duration variable Hide the details

<Time used>..Hour = <New time>
<Time used>: Time, DateTime or Duration
Name of the Time, DateTime or Duration variable to use.
<New time>: Character string or integer
New time in digits, included between 0 and 23. Replaces the time in the specified variable.
WEBDEV - Browser code Not available in browser code

Finding out the time of a Time or Date item ("Date Time" or "Duration" format) Hide the details

<Result> = <File name>.<Item name>..Hour
<Result>: Integer
Time on 2 digits.
<File name>: Character string (with or without quotes)
Name of the file used. This name was defined in the data model editor or by the File description type.
<Item name>: Character string (with or without quotes)
Name of item used. This name was defined in the data model editor or by the Item description type.
WEBDEV - Browser code Not available in browser code

Modifying the time of a Time or Date item ("Date and Time" or "Duration" format) Hide the details

<File name>.<Item name>..Hour = <New time>
<File name>: Character string (with or without quotes)
Name of the file used. This name was defined in the data model editor or by the File description type.
<Item name>: Character string (with or without quotes)
Name of item used. This name was defined in the data model editor or by the Item description type.
<New time>: Character string or integer
New time in digits, included between 0 and 23. Replaces the time in the specified item.
Remarks

Managing times

Case 1: Direct assignment
During a direct assignment (for example, Day.StartTime..Hour = n), the time must be included between 0 and 23. A WLanguage error occurs if the specified time is invalid.
The notation Day.StartTime..Hour = Day.StartTime..Hour + 5 may generate an error at run time.
Case 2: Operations on times
When performing operations on the times of the Time or Date items ("Date and Time" format), the change of time is automatically managed.
The addition or subtraction of hours automatically takes into account the change from hour 23 to hour 0.
Therefore, if an hour is added to:
  • a Time item corresponding to 23:35, the result will correspond to 0:35
  • a Date item (Date and Time format), the time and the date will be modified (a day will be added).
// Example on a variable
StartTime is Time = "2335"
StartTime..Hour++                            // StartTime = 0035
StartDate is Date = "200411262335"        // 26/11/2004 at 23:35
StartDate..Hour++                             // 27/11/2004 at 00:35

Managing durations

If the number of hours in a duration is greater than 23:59, the number of days is automatically incremented.

Operators available for hours

The following arithmetic operators can be used by ..Hour:
  • ++ and --
  • += and -=
// Example on an item
Day.StartTime = "1230"
Day.StartTime..Hour++     // Add 1 hour
Day.StartTime..Hour+=5    // Add 5 hours
Day.StartTime..Hour-=5    // Subtract 5 hours
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment