VariableTimestamp
Extracts the timestamp from a given variable.
Note: This function is designed to be used within Cicode; using it on graphical pages may result in displaying an error message instead of an expected timestamp message when either its argument has not good quality or an execution error is set.
Syntax
VariableTimestamp(Variable, INT Type)
Variable:
The variable from which the timestamp will be extracted.
Type:
The type of timestamp:
0 – The element’s date/time (default)
1 – The element’s quality date/time
2 – The element’s value date/time
Return Value
A TIMESTAMP of the given variable depending on the type. If Variable is NULL, returns INVALID_TIMESTAMP.
Timestamps of uninitialized stack variables, uninitialized code variables and constants are equal to 0 - invalid timestamp, while their qualities are GOOD
Related Functions
TimestampAdd, TimestampCurrent, TimestampDifference, TimestampSub, TimestampToStr, TimestampFormat, TimestampGetPart, TimestampToTimeInt, TimeIntToTimestamp,
Example
INT codeVariable = 1;
INT
FUNCTION
MyFunction(REAL arg1)
STRING str = "My string";
TIMESTAMP ts;
ts = VariableTimestamp(codeVariable, 0); //code variable
ts = VariableTimestamp(arg1, 0); //function argument
ts = VariableTimestamp(str, 0); //stack variable
ts = VariableTimestamp(Tag1, 0); //any tag/local variable
RETURN 1;
END
See Also