PHP MSSQL and DataType `smalldatetime`

Posted on

During the development of a project we ran into a problem when using mssql_query() on a Microsoft SQL Database table with a column of a datatype `smalldatetime`. 

It would appear PHP was returning a dataset from MSSQL but was not allowing the script to continue processing even though a valid dataset was returned.  After some digging we found a bug on the PHP website, inherently there was a short term fix which is to disable the converting of MS SQL `smalldatetime` to a PHP date.

Disabling the converting of a MSSQL datetime to a PHP date was quite simple;

ini_set('mssql.datetimeconvert', 0);

I hope this finds someone well.

Want to discuss a project?

Talk to our Magento experts on 01785 279920

Request a callback