ParseTime (Tag-based PE function)
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Translate a PI time expression to a timestamp. Use regular time expression inside single quotes for better performance.
Syntax
ParseTime(s1)
Arguments
s1
A character string in PI time format, enclosed in double quotes
Returns
The timestamp corresponding to s1
Exceptions
If s1 is not a character string, or if there is a syntax error, returns an error value
Notes
There is no difference between and the time expression , except that the ParseTime call takes more time. This is because the time expression (enclosed in single quotes) is evaluated at compile time, not run time. Therefore it is most efficient to use a time expression (enclosed in single quotes.)
If you write (using single quotes, not double quotes) the parser detects an error, because the expression in single quotes is already translated to a timestamp at compile time
The expression is not the same as the time expression . The ParseTime expression is evaluated at run time and translated using '*' as the relative time base, while the time expression is evaluated at compile time and uses the time the expression is parsed as the relative time base
Example
ParseTime(Concat("12", "-31", "-16"))
-
[Returns 12/31/2016 12:00:00 AM, which is the same as '12/31/16']
ParseTime("14-Dec-16")
-
[Renders the same result as '14-Dec-16'. Use only when string operations are necessary]
ParseTime("*")
-
[Renders the same result as '*'. Use only when string operations are necessary]