Edit report at http://pear.php.net/bugs/bug.php?id=11849&edit=1

ID: 11849
Comment by: kkotowicz@gmail.com
Reported By: smh at wannafind dot dk
Summary: mssql.datetimeconvert force set to 0 - generate wrong
Status: Assigned
Type: Bug
Package: MDB2_Driver_mssql
Operating System: Linux
Package Version: 1.2.1
PHP Version: 5.2.1
Assigned To: davidc
Roadmap Versions:
New Comment:

I had the same problem with MSSQL Driver v1.2.1 and newest (as of
today) FreeTDS. Recompiling PHP helped - more info at

Previous Comments:

[2007-08-16 08:27:52] davidc

I'll have a look at this, adding an option could be possible I think.


[2007-08-16 04:27:51] smh

Probably due to a PHP bug, it seems that when mssql.datetimeconvert is
set to 0. Dates from a MSSQL is converted from 16-08-2007 to 16-07-2007.
I assume that PHP takes the last to digits as month - this might be
caused by the MSSQL servers timeformat (it's a danish MSSQL server,
probably with danish date format).

It would be preferrable if the MSSQL connect method didn't
automatically set mssql.datetimeconvert to 0 or at least if the option
could be given through the DSN string to avoid this behavior.

Test script:

$dsn = 'mssql://user:pass@host:1433/db'
$options = array(
'debug' => 2,
'portability' => MDB2_PORTABILITY_ALL,

$conn =& MDB2::connect($dsn, $options);

$res = $conn->query("select date_field from date_table");
$row = $res->fetchRow();
echo $row["date_field"];


Expected result:
I expected the script to output 2007-08-16

Actual result:
The script output 2007-07-16


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedSep 29, '09 at 4:29p
activeSep 29, '09 at 4:29p

1 user in discussion

Kkotowicz: 1 post



site design / logo © 2022 Grokbase