I’m trying to create a report from a proprietary ERP database. I’ve set up an ODBC connection and am using PHP to pull data from the database.
If I use Microsoft SQL Server Management Studio I can see that a row has a TimeStamp field (string type) with a value of 0x00000000093E7FCA, which apparently corresponds to 2011-02-04. (All fields in this table are string type. No idea why. Seems lazy.)
If I do a var_dump of the returned ODBC object I get:
public 'TimeStamp' => string '���� >Â' (length=8)
How do I convert this string value to its hexadecimal equivalent (in this case 0x00000000093E7FCA) using PHP?
I have tried:
$row->TimeStamp + 0; // '0' ...nope.
(binary)$row->TimeStamp; // '���� >Â' ...close!
(int)((binary)$row->TimeStamp); // '0' ...doh!
I would try
bin2hex($row->TimeStamp)Docs: https://www.php.net/manual/en/function.bin2hex.php