PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Managing hours
  • Managing the durations
  • Operators available for the 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 hour from a Hour or DateTime variable, or the number of hours from a Duration variable.
  • Modify the hour in a Hour or DateTime variable, or the number of hours in a Duration variable.
  • Retrieve the hour or the number of hours from a Date item (in "Date and Time" or "Duration" format) or from a Hour item.
    WEBDEV - Browser code Not available.
  • Modify the hour or the number of hours in a Date item (in "Date and Time" or "Duration" format) or in a Hour item.
    WEBDEV - Browser code Not available.
Note: ..Hour is used to simplify the operations performed on the times and durations (add one hour, ...).
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 the 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 the hours
Day.StartTime..Hour = 10
Syntax

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

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

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

<Hour Used>..Hour = <New Hour>
<Hour Used>: Time, DateTime or Duration
Name of Hour, DateTime or Duration variable to use.
<New Hour>: Character string or integer
New hour 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 hour of a Time or Date item ("Date Time" or "Duration" format) Hide the details

<Result> = <File Name>.<Item Name>..Hour
<Result>: Integer
Hour 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 hour of a Time or Date item ("Date Time" or "Duration" format) Hide the details

<File Name>.<Item Name>..Hour = <New Hour>
<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 Hour>: Character string or integer
New hour in digits, included between 0 and 23. Replaces the hour in the specified item.
Remarks

Managing hours

Case 1: Direct assignment
During a direct assignment (for example, Day.StartTime..Hour = n), the hour must be included between 0 and 23. A WLanguage error occurs if the specified hour is invalid.
The notation Day.StartTime..Hour = Day.StartTime..Hour + 5 may generate an error at run time.
Case 2: Operations on the hours
When performing operations on the hours of the Time or Date items ("Date and Time" format), the change of hour 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 the durations

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

Operators available for the 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 required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment