The PHP Sqlsrv driver for the Sql server 2008 will return dateTime as an Object by default.If you need to use it in PHP then you need to convert into string. The new sqlsrv driver is blessed with the option to convert dateTime to string. You just need to set “ReturnDatesAsStrings” option as TRUE.
$host = "192.168.1.1"; $connectionInfo = array( "UID" => "db_user", "PWD" => "db_password", "Database" => "db_sample", "ReturnDatesAsStrings" =>1 ); sqlsrv_connect($host, $connectionInfo);
Thatz it you have done it. Now the sqlsrv driver for PHP will return all the datetime fields as string.