Discussion:
[freetds] datetime problem in php with mssql.datetimeconvert = Off‏
wamon
2012-07-03 02:59:45 UTC
Permalink
The format of my previous email was totally messed up. So I'm sending it again.

Hi,
I have a new setup of centos 6.2 with following packages installed:

[root at centos6 ~]# rpm -qa|grep php
php-devel-5.3.3-3.el6_2.8.i686
php-common-5.3.3-3.el6_2.8.i686
php-5.3.3-3.el6_2.8.i686
php-ldap-5.3.3-3.el6_2.8.i686
php-mysql-5.3.3-3.el6_2.8.i686
php-cli-5.3.3-3.el6_2.8.i686
php-pdo-5.3.3-3.el6_2.8.i686
php-mssql-5.3.3-1.el6.i686
[root at centos6 ~]# rpm -qa|grep freetds
freetds-0.91-2.el6.i686

I have a simple test php program as followed:

<?php
// connect database ...
$rs=mssql_query("select cast(getdate() as varchar),getdate()");
$row=mssql_fetch_row($rs);
print_r($row);
?>

With mssql.datetimeconvert = On in php.ini, I got:
Array
(
[0] => Jul 2 2012 10:23PM
[1] => Jul 2 2012 10:23:39:073PM
)

But with mssql.datetimeconvert = Off, I got this strange result:
Array
(
[0] => Jul 2 2012 10:25PM
[1] => 2012-03-07 13625386
)

Could anyone tell me how to fix it?
Thanks,

Amonw

Loading...