ph_getvar_d PowerHome formula function
Description
Retrieves the specified system variable as a date.
Syntax
ph_getvar_d ( 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 date. This would look like ph_getvar_d(4,2).
num Integer. The number of the specified system variable type you wish to retrieve. To retrieve system variable TEMP7 use ph_getvar_d(2,7).
Return value
Date. The data stored within the specified system variable returned as a date. You should be certain that the system variable contains data that can be properly converted to a date value.
Examples
The following examples demonstrate typical syntax/ usage for this function.
• ph_getvar_d (1,2)   --> get the date from LOCAL2. The result is returned in a datetime format with zero time values, eg --> 01/23/2014 00:00:00
• ph_getvar_d (2,4)   --> get the date from TEMP4. The result is returned in a datetime format with zero time values, eg --> 01/23/2014 00:00:00