|
|
|
|
|
- Managing the minutes and the hours
- Operators available for the minutes
The Minute property is used to: - Retrieve the minutes from a Time or DateTime variable, or the number of minutes from a Duration variable.
- Change the minutes in a Time or DateTime variable, or the number of minutes in a Duration variable.
- Retrieve the minutes or the number of minutes from a Date item (in "Date and Time" or "Duration" format) or from a Time item.
 Not available. - Modify the minutes or the number of minutes in a Date item (in "Date and Time" or "Duration" format) or in a Time item.
 Not available.
Remark: The Minute property simplifies time and duration offset operations (adding an hour, etc.). 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)
Versiones 20 y posterioresStartTime is Time = "1230" // Add 50 minutes StartTime.Minute += 50 // StartTime corresponds to 13:20 // Modify the minutes StartTime.Minute = 10
Work.StartTime = "1230" // Add 50 minutes Work.StartTime.Minute += 50 // StartTime corresponds to 13:20 // Modify the minutes Work.StartTime.Minute = 10
Sintaxis
Finding out the number of minutes in a Time, DateTime or Duration variable Ocultar los detalles
<Result> = <Time>.Minute
<Result>: Integer Number of minutes on 2 digits. <Time>: Time, DateTime or Duration Name of the variable of type Time, DateTime or Duration to be used.
Modifying the number of minutes in a Time, DateTime or Duration variable Ocultar los detalles
<Time>.Minute = <New number of minutes>
<Time>: Time, DateTime or Duration Name of the variable of type Time, DateTime or Duration to be used. <New number of minutes>: Character string or integer New number of minutes (included between 0 and 59). Replaces the number of minutes in the specified variable.
Finding out the number of minutes in a Time or Date item (in "Date and Time" or "Duration" format) Ocultar los detalles
<Result> = <Data file>.<Item>.Minute
<Result>: Integer Number of minutes on 2 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 minutes in a Time or Date item (in "Date and Time" or "Duration" format) Ocultar los detalles
<Fichier de données>.<Rubrique>.Minute = <Nouveau nombre de minutes>
<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 minutes>: Character string or integer New number of minutes (included between 0 and 59). Replaces the number of minutes in the specified item. Observaciones Managing the minutes and the hours Case 1: Direct assignment When assigning directly (for example, MyTime.Minute = n), minutes must be between 00 and 59. A WLanguage error occurs if an invalid number of minutes is specified. The notation MyTime.Minute = MyTime.Minute + 5 may generate a runtime error. Case 2: Operations on minutesWhen performing operations on Time and DateTime, variables, hours go from 0 to 23, and minutes go from 0 to 59. The addition or subtraction of minutes automatically takes into account the changes from 59 minutes to the next hour. Therefore, if 50 minutes are added to: - a variable of type Time corresponding to 23:35, the result will be 0:25.
- a variable of type DateTime, the hour and the number of minutes will be modified (an hour will be added).
// Example on a variable StartTime is Time = "2335" StartTime.Minute += 50 // StartTime corresponds to 0:25 StartTime is DateTime = "202011262335" StartTime.Minute += 50 // StratTime corresponds to 27/11/2020 at 0:25
Operators available for the minutes The following arithmetic operators can be used with the Minute property: // Example on an item Work.StartTime = "1320" Work.StartTime.Minute++ // Add 1 minute Work.StartTime.Minute+=5 // Add 5 minutes Work.StartTime.Minute-=5 // Subtract 5 minutes
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|