note 82854 deleted from function.mssql-query by cmb
| From: | cmb@php.net | Date: | Sun, 23 Jun 2019 14:20:48 +0000 |
| Subject: | note 82854 deleted from function.mssql-query by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211366@lists.php.net to get a copy of this message | ||
Note Submitter: hpainter at gmail dot com
----
I was tripped up by the fact that mssql_query() returns values for 'datetime' columns in
an unusual format. In order to get your values returned in the usual 'YYYY-MM-DD
HH:MM:SS' format, you can use the CONVERT function in your query like so:
SELECT CONVERT(varchar, INVOICE_DATE, 121) AS INVOICE_DATE ...
where 'INVOICE_DATE' is the name of the 'datetime' column. The available
datetime conversion formats are listed here:
http://msdn2.microsoft.com/en-us/library/aa226054(SQL.80).aspx