Skip to Content.
Sympa Menu

freetds - Re: [freetds] Get rid of milliseconds from MS SQL server

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: martin <martin AT allbsd.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Get rid of milliseconds from MS SQL server
  • Date: Sat, 01 Oct 2005 08:04:54 -0700


select convert(varchar,getdate(),120)

remember to do any date adding etc. before converting
e.g.
select convert(varchar,dateadd(day,7,getdate()),120)

note : the "120" is the style for how the date is represented.
120 = yyyy-mm-dd hh:mi:ss



James K. Lowden wrote:
Frediano Ziglio wrote:

Il giorno ven, 30/09/2005 alle 10.48 -0700, Patrick Gu ha scritto:

Hi,

I am using freetds 0.63 with DBD::ODBC to pull data from MS SQL Server
2000 to RH AS3. But I am getting the milliseconds for the date columns
in the format of
YYYY-MM-DD HH:MI:SS.SSS, anyone know if there is a quick way in
freetds or DBD::ODBC to set the format?

Thanks!


Well... it depends. If server return (SMALL)DATETIME column FreeTDS
format it to ODBC format (the same you reported) if column is converted
by mssql you should check mssql documentation (tsql, cast, convert, set
dateformat...). I don't know if DBD::ODBC have options to set date
format for DATETIME... MS ODBC driver have an option to use system
setting to format data as system settings; FreeTDS don't have such
option for simplicity, and it do not even support precision setting on
date.


Isn't this what the "date format" in locales.conf takes care of?
--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page