Int
- Last UpdatedJan 11, 2023
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Return the integer part of an integer or real number.
Syntax
Int(x)
Arguments
-
x
Number, Boolean, numeric string, timespan, or an attribute whose value evaluates to a number at time of evaluation
Returns
If x is a number, the integer part of x is returned. If x is a string, it is first converted into a number. If x is a timespan, the number of seconds from 12:00am January 1, 1970 is returned
Exceptions
Returns error if the variable is not assigned
Notes
returns UTC time in seconds from 12:00am January 1, 1970
Example
-
Int('att1')
[Return the integer part of the value of 'att1' at current time]
-
Int('*'-'t')
[Return how many seconds have passed since the start of day today]
-
Int(2.1)
[Returns 2]
-
Int("2.1")
[First converts the string to a number and returns 2]
-
Int(true)
[Returns 1]