|
Posted by davemateer on 02/16/06 23:24
Hi
SQL Server 2000 Database:
Table: Thing
Columns: id (int), nameOfThing (int), dateOfThing (datetime)
I put some data in it:
1, dave, 9/11/1973 14:33:22
2, bill, 12/6/1980 13:23:33
Then I run a query from PHP4.4.0-3 (on Ubuntu) from Apache2.
<?php
$db_server = "192.168.1.123";
$model_connection = mssql_connect ($db_server, "user", "password");
mssql_select_db ("davetest", $model_connection);
$sql = "select dateOfThing from Thing where id = 1";
$result = mssql_query($sql, $model_connection);
$myarray = mssql_fetch_row ($result);
print_r($myarray);
?>
Result is this:
Array ( [0] => Tue Sep 11 00:00:00 1973 )
When I really want: 9/11/1973 14:33:22
I thought I'd fixxed it with the php.ini line:
mssql.datetimeconvert = Off
However it still returns the same 'converted' datetime.
I have restarted Apache and restarted the machine. I have made sure
this is the correct php.ini file I'm editing too.
Summary
On our production box which is running PHP4.2.3 I get:
PHP4.2.3 - Sep 11 1973 2:33PM (notice it is even chopping off seconds)
PHP4.4.0-3 - Tue Sep 11 14:33:22 1973
How to turn off this date conversion / formatting?
Cheers
Dave.
Navigation:
[Reply to this message]
|