Skip to Content.
Sympa Menu

freetds - Re: datetime format

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Winkless, Geoff" <geoff.winkless AT pera.com>
  • To: 'TDS Development Group' <freetds AT franklin.oit.unc.edu>
  • Subject: Re: datetime format
  • Date: Mon, 17 Dec 2001 09:34:12 -0000


James K. Lowden wrote:
> MS SQL Query Analyzer is an ODBC tool. It's default datetime
> display is controlled by some ODBC settings. I don't know
> the details.

No it's not. It's specifically for MS SQL Server - basically it's the
updated version of isql/w. You're probably thinking of MS Query, the crappy
thing that comes with Office.

> If the server is consistent (always MS SQL Server or Sybase), the most
> portable way probably *is* to coerce the format with convert.

The best way is to use the standard ANSI format and fit your code around it.

You may find that you need to put

SET DATEFORMAT YMD

in front of your queries though because MS in their infinite wisdom decided
that if you're in a country (eg Europe) which has its normal date format as
dd/mm/yy as opposed to mm/dd/yy (a la USA) SQL Server automatically switches
round day and month even in formats which are -defined- as non-changeable -
so if you set SQL up with (eg) a UK locale it actually returns ANSI dates as
YYYY-DD-MM (eurgh).

Geoff




Archive powered by MHonArc 2.6.24.

Top of Page