Home » Database » DB » Bug #2369
MSSQL datetime retrieval error for ini_set("mssql.datetimeconvert", 0)
Details
| Submitted | 2004-09-22 01:16 UTC |
|---|---|
| From | chen at hpfm dot com dot au |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 4.3.5 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-09-22 01:16 UTC] chen at hpfm dot com dot au
Description:
------------
For MSSQL, I set ini_set("mssql.datetimeconvert", 0)
and did a query retreving a record from the database.
Suppose a column DOB of type datetime with the data of
2004-09-14 00:00:00.000 in the database, then then the
retrieved data will be 2004-08-14. That is, only the month is not correct and is (the true value in the DB - 1).
FYI, if I don't set ini_set("mssql.datetimeconvert", 0),
then the retreved data is correct. Of course, the date format will be like 14 Sep 2004.
Reproduce code:
---------------
<?php
if($db)
{
$result = $db->query('select * from aTable where id=1010');
$row = $result->fetchRow();
Var_Dump::display($row);
}
?>
[2004-09-22 06:00 UTC] chen at hpfm dot com dot au
In my script, I had the following line,
ini_set("mssql.datetimeconvert", 0)
The system default is mssql.datetimeconvert=1.
By comment the above line off, I compared the results
between mssql.datetimeconvert=0 and mssql.datetimeconvert=1.
The results are,
for mssql.datetimeconvert=1, the retreved data was correct.
That is, it was the same as the data in database;
for mssql.datetimeconvert=0, the retreved data was wrong.
Of course, the date formats were different.
[2004-09-22 06:07 UTC] chen at hpfm dot com dot au
Probably, it's a php issue.
http://bugs.php.net/bug.php?id=22060