PHP, COM, and Date Type
| From: | James Van Lommel | Date: | Tue, 12 Dec 2006 16:07:50 +0000 |
| Subject: | PHP, COM, and Date Type | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-27314@lists.php.net to get a copy of this message | ||
I need help converting a PHP variable to a Date type for a COM
function parameter. (Yes, I know PHP has weak typing... that's the
problem.)
Passing a value to the COM object's function (CrystalReports XI
ParameterField -> AddCurrentValue(), if that matters to you) works if
the object is expecting a number or a string...
However, if it is expecting a Date I cannot use a PHP string or the
VT_DATE variant, it seems.
All of the sample code in VB or for ASP takes advantage of the
Microsoft function CDate() to convert a string to a Date Type.
Right now I'm trying something like:
$dt = variant_date_from_timestamp($timestamp);
$vVal = new VARIANT($dt, VT_DATE);
$this->param->AddCurrentValue($vVal);
The last line throws a com_exception.
Any one else come across this or have any hints as to how it can be
worked around?
- James