ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage properties / Time and date management properties
  • Managing the milliseconds
  • Operators available for the milliseconds
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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 simplifies time and duration offset operations.
Reminder: Date items are used to handle:
  • 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
// Exemple sur une variable
HeureDébut is DateTime = "200112311230250"
// Ajouter 50 millisecondes
HeureDébut.Millisecond += 50	// HeureDébut correspond à 200112311230300
// Modifie le nombre de millisecondes
HeureDébut.Millisecond = 50
// Exemple sur une rubrique
Travail.HeureDébut = "200112311230250"
// Ajouter 50 millisecondes
Travail.HeureDébut.Milliseconde += 50 // HeureDébut correspond à 200112311230300
// Modifie le nombre de millisecondes
Travail.HeureDébut.Milliseconde = 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

<Fichier de données>.<Rubrique>.millisecond = <Nouveau nombre de millisecondes>
<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 (between 0 and 999).
Remarks

Managing the milliseconds

Case 1: Direct assignment
When assigning directly (for example, MyWork.MyDateTime.Millisecond = n), milliseconds must be between 0 and 999. A WLanguage error occurs if a wrong number is specified.
The notation MyWork.MyDateTime.Millisecond = MyWork.MyDateTime.Millisecond + 50 may generate a runtime error.
Case 2: Operations on milliseconds
When operations are carried out on the hours of date fields (in "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.
// Exemple sur une variable
DateHeureDébut is DateTime = "2004112613240320"	// 26/11/2004 13:24:03:20
DateHeureDébut.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 -=
// Exemple sur une rubrique
Travail.DateHeureDébut = "200411261324320"
Travail.DateHeureDébut.Milliseconde ++	// Ajouter 1 milliseconde
Travail.DateHeureDébut.Milliseconde +=5	// Ajouter 5 millisecondes
Travail.DateHeureDébut.Milliseconde -=5	// Retrancher 5 millisecondes
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/13/2025

Send a report | Local help