|
|
|
|
|
- Managing the milliseconds
- Operators available for the milliseconds
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).
 Not available. - Modify the milliseconds or number of milliseconds in a Date item ("Date and Time" or "Duration" format).
 Not available.
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 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
Sintaxis
Finding out the number of milliseconds in a DateTime or Duration variable Ocultar los detalles
<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 Ocultar los detalles
<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) Ocultar los detalles
<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) Ocultar los detalles
<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). Observaciones 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. // 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: // 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
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|