note 52234 deleted from ref.com by cmb
| From: | cmb@php.net | Date: | Sun, 30 Jun 2019 08:00:38 +0000 |
| Subject: | note 52234 deleted from ref.com by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211424@lists.php.net to get a copy of this message | ||
Note Submitter: angelo [at] mandato <dot> com
----
ADO + PHP5 + SQL DATE FIELDS
Using a COM("ADODB.Connection") object in PHP4 and PHP5 to return date fields in databases
will have different results.
In PHP4, the date is returned as a string as represented in the database. In my case,
'2005-04-11 11:35:44'.
In PHP5, the date is returned as a VARIANT type, when printed or implicitly casted would result as
'4/11/2005 11:35:44 AM'.
For this example, the solution is to use the variant conversion function variant_date_to_timestamp()
to convert the value to a Unix timestamp.
Please refer to this as an example. Other date types may be converted using one of the other
variant_<convert> functions.