Date: 03/21/99
- Next message: tarmon <email protected>: "[PHP-DEV] Bug #1253: ucwords hang"
- Previous message: Sascha Schumann: "Re: [PHP-DEV] Bug #1251: snmpwalk function causes segfault"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: balchen <email protected>
Operating system: NT 4.0 build 1381 (SP 3, multi-processor kernel)
PHP version: 3.0.6
PHP Bug Type: Other
Bug description: Incorrect datetime representation in php3_mssql
Datetime fields are represented in MS SQL as 8 byte floating point numbers, and the return value in an SQL query is a 17 byte string, but the module php3_mssql seems to interpret them a an 8 byte string.
When executing a command similar to this,
list(.., $date, ...) = mssql_fetch_row($result);
you get a $date that contains the first 8 bytes of the return value instead of the actual date string. This means that (at least on my system), $date contains "Mar 21 1", whereas the return value from MS SQL is "Mar 21 1999 21:00".
date() totally gives up when giving it $date, and returns Jan 01 1970. The only solution is to execute a slightly modified SQL statement, converting the datetime field to a varchar using CONVERT, like this:
SELECT CONVERT(varchar(17), datefield) FROM table
This will return a 17 byte string that php3_mssql doesn't fuck up.
It doesn't like a system-specific problem to me, but anyway: I'm running NT 4.0, SQL Server 6.5, PHP for Win32 3.0.6 using IIS 4.0.
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: tarmon <email protected>: "[PHP-DEV] Bug #1253: ucwords hang"
- Previous message: Sascha Schumann: "Re: [PHP-DEV] Bug #1251: snmpwalk function causes segfault"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

