[freetds] Dates fetched from MSSQL are off by 1 month
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Fri Nov 17 04:34:05 EST 2006
>
> 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
Hi,
I'm sorry but you have to recompile somthing... starting from 0.63 there are very few differences compiling freetds with or without --enable-msdblib. The only difference is in tds_sysdep_public.h header which define programs default. So you have to recompile PHP adding a MSDBLIB define. If you are using RH if should be possible to recompile php packages with rpmbuild given a specific option (--with mssql if I remember)
bye
freddy77
More information about the FreeTDS
mailing list