ph_getvar_dt PowerHome formula function
Description
Retrieves the specified system variable as a datetime.
Syntax
ph_getvar_dt ( type, num )
Argument |
Description |
type
|
Integer. The type of system variable you wish
to retrieve. Valid values are 1, 2, 3, and 4. A 1 specifies that you wish
to retrieve LOCAL variables (the same as system variables LOCAL1 thru
LOCAL10), a 2 specifies that you wish to retrieve TEMP variables (the same
as system variables TEMP1 thru TEMP10), and a 3 specifies that you wish to retrieve GLOBAL variables (the same as system variables GLOBAL1 thru GLOBAL20). A value of 4 is a special case and represents data that is only available during the execution of Analog I/O formulas (the Calculated to Raw and Raw to Calculated formulas). Use a num value of 2 to return the calc value of the Analog device as a datetime. This would look like ph_getvar_dt(4,2). |
num
|
Integer. The number of the specified system variable type you wish to retrieve. To retrieve system variable TEMP7 use ph_getvar_dt(2,7). |
Return value
Datetime. The data stored within the specified system variable returned as a datetime. You should be certain that the system variable contains data that can be properly converted to a datetime value.
Examples
The following examples demonstrate typical syntax/ usage for this function.
• ph_getvar_dt (1,2) --> get the datetime from LOCAL2. The result is returned in a datetime format, eg --> 01/23/2014 14:31:25:583
• ph_getvar_dt (2,4) --> get the datetime from TEMP4. The result is returned in a datetime format, eg --> 01/23/2014 14:31:25:583