Skip to Content.
Sympa Menu

freetds - [freetds] Dates fetched from MSSQL are off by 1 month

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Ole Christian Schroder" <ole.schroder AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Dates fetched from MSSQL are off by 1 month
  • Date: Thu, 16 Nov 2006 16:43:08 +0100

Hello everyone,
we are using a PHP application that communicates with a mssql database
using the freetds libraries. We have it running on RH9, but have
started to upgrade to RHE4 and in this process we have encountered a
problem with the dates being displayed wrong when fetching them from
the database. More specifically the month is adjusted by one, thus
november becomes october (or more correctly, 11 becomes october).

The date is entered and fetched from the database with the same
application. It appears that the date is correctly stored in the db,
but adjusted when it is read, thus the application sees the wrong
date.

I did a lot of searching before finding any leads, but one thing I did
find was the following:

<--
...under linux the driver for mssql is SYBASE alias, and FreeTDS is set
to work with SYBASE by default. The problem is that sybase counts months
from 0 to 11, and mssql from 1 to 12. that´s the cause of that strange
one month less. To correct this, u have to compile FreeTDS with a
"--enable-msdblib".
-->

Based on that I thought it was worth a shot asking here if this is a
probable cause, and if it is – is there any other way than recompiling
to get around this?

This is only an issue on our RHE4 installation and not on the RH9.

On RHE4 we are using freetds-0.63-1.2.el4.rf and on the RH9 we are
using freetds-0.62-9

All ideas are welcome.

rgds,

Ole C. Schroder




Archive powered by MHonArc 2.6.24.

Top of Page