Skip to Content.
Sympa Menu

freetds - Re: DATETIME problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT speakeasy.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: DATETIME problem
  • Date: Wed, 19 Dec 2001 01:01:09 -0500


> Stefan Carstens wrote:
>
> We defined some tables with DATETIME types.
> If we fetch the data via the SQLAnalyzer we see the correct time,
> "12.12.2001:23:34:34.045" for example.
> If we do so with PHP's mssql_query, the seconds are missing.
> We use freetds 0.53pre3.
> What is wrong ?

Stefan,

What exactly does the PHP output look like? If you're relying on the
default conversion, that would explain the behavior you're describing.

As explained in an earlier thread, SQL Query Analyzer uses Microsoft's
ODBC to communicate with the server, and renders datetime fields in
"ODBC format" which IIRC is an ISO/ANSI standard. Db-lib programs
behave differently; try Microsoft's isql command-line tool and see for
yourself.

Somebody somewhere is converting the 8-byte datetime structure to a
string. I don't know, in the PHP-FreeTDS mix, who does that
conversion. If you want output that looks like
"12.12.2001:23:34:34.045", I recommend including a CONVERT statement in
your query to explicitly format the string.

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page