ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage properties / Time and date management properties
  • Managing the milliseconds
  • Operators available for the milliseconds
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The Millisecond property is used to:
  • Retrieve the number of milliseconds from a Time, DateTime or Duration variable.
  • Modify the number of milliseconds in a Time, DateTime or Duration variable.
  • Retrieve the milliseconds or the number of milliseconds from a Date item (in "Date and Time" or "Duration" format).
  • Modify the milliseconds or number of milliseconds in a Date item ("Date and Time" or "Duration" format).
Remark: The Millisecond property is used to easily change times and durations.
Reminder: Date items are used to manage:
  • simple dates: "Year - Month - Day" (YYYYMMDD format)
  • dates and times: "Year - Month - Day - Hours - Minutes - Seconds - Milliseconds" (YYYYMMDDHHmmSSCCC format)
  • durations: "Number of days - Number of hours - Number of minutes - Number of seconds - Number of milliseconds" (+DHHMMSSCCC format)
Example
// Example on a variable
StartTime is DateTime = "200112311230250"
// Add 50 milliseconds
StartTime.Millisecond += 50 // StartTime corresponds to 200112311230300
// Modifies the number of milliseconds
StartTime.Millisecond = 50
// Example on an item
Work.StartTime = "200112311230250"
// Add 50 milliseconds
Work.StartTime.Millisecond += 50 // StartTime corresponds to 200112311230300
// Modifies the number of milliseconds
Work.StartTime.Millisecond = 50
Syntax

Finding out the number of milliseconds in a DateTime or Duration variable Hide the details

<Result> = <Time>.Millisecond
<Result>: Integer
Number of milliseconds on 3 digits.
<Time>: DateTime or Duration
Name of the variable of type Time, DateTime or Duration to be used.

Modifying the number of milliseconds in a DateTime or Duration variable Hide the details

<Time>.Millisecond = <New number of milliseconds>
<Time>: DateTime or Duration
Name of the variable of type Time, DateTime or Duration to be used.
<New number of milliseconds>: Character string or integer
New number of milliseconds (included between 0 and 999).

Finding out the number of milliseconds in a Date item ("Date and Time" or "Duration" format) Hide the details

<Result> = <Data file>.<Item>.Milliseconds
<Result>: Integer
Number of milliseconds on 3 digits.
<Data file>: Character string
Name of the data file used. This name was defined in the data model editor or with the File Description type.
<Item>: Character string
Name of the item used. This name is defined in the data model editor or with the Item Description type.

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

<Data file>.<Item>.Millisecond = <New number of milliseconds>
<Data file>: Character string
Name of the data file used. This name was defined in the data model editor or with the File Description type.
<Item>: Character string
Name of the item used. This name was defined in the data model editor or with the Item Description type.
<New number of milliseconds>: Character string or integer
New number of milliseconds (included between 0 and 999).
Remarks

Managing the milliseconds

Case 1: Direct assignment
During a direct assignment (for example, MyWork.MyDateTime.Millisecond = n), the milliseconds must be included between 0 and 999. A WLanguage error occurs if a wrong number is specified.
The following notation MyWork.MyDateTime.Millisecond = MyWork.MyDateTime.Millisecond + 50 may generate a runtime error.
Case 2: Operations on the milliseconds
When performing operations on the hours found in the Date items ("Date and Time" or "Duration" format), the change of minutes is automatically managed. The addition or subtraction of milliseconds automatically takes into account the change from 999 milliseconds to 1 minute.
// Example on a variable
StartDateTime is DateTime = "2004112613240320" // 26/11/2004 13:24:03:20
StartDateTime.Millisecond += 800 // 26/11/2004 13:24:04:00

Operators available for the milliseconds

The following arithmetic operators can be used with the Millisecond property:
  • ++ and --
  • += and -=
// Example on an item
Work.StartDateTime = "200411261324320"
Work.StartDateTime.Millisecond ++ //Add 1 millisecond
Work.StartDateTime.Millisecond +=5 // Add 5 milliseconds
Work.StartDateTime.Millisecond-=5 // Subtract 5 milliseconds
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/06/2024

Send a report | Local help