FAQ
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
dates
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
http://blog.kotowicz.net/2009/09/weird-date-format-from-freetds-with.html


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

Description:
------------
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:
---------------
<?php

$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 @
categoriesphp
postedSep 29, '09 at 4:29p
activeSep 29, '09 at 4:29p
posts1
users1
websitepear.php.net

1 user in discussion

Kkotowicz: 1 post

People

Translate

site design / logo © 2022 Grokbase