Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI System Management Tools

ParseTime (Tag-based PE function)

  • Last UpdatedOct 04, 2024
  • 1 minute read

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 ParseTime("14-Nov-92") and the time expression '14-Nov-92', 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 ParseTime('14-Nov-92') (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 ParseTime(":12:00:00") is not the same as the time expression ':12:00:00'. 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]

In This Topic
TitleResults for “How to create a CRG?”Also Available in