sqlsrv date time converstion

May 30th, 2011 § 0 comments § permalink

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.

cakephp sqlsrv dbo

February 7th, 2011 § 6 comments § permalink

Are you using cakePHP with Sql server 2008?  Then you might be using new PHP driver for connecting it.Here is the dbo which supports the sqlsrv driver in cakePHP. you are free to download and use it. If you find any bug please let me know. If you are interested in fixing bugs please fork the project in github.

Download

Please leave your response

Thank you

Happy baking.