Skip to Content.
Sympa Menu

freetds - Re: datetime format

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 format
  • Date: Sun, 16 Dec 2001 20:11:05 -0500


Bradley Bell wrote:
>
> Hi, when selecting a datetime value using freetds, I get values such as:
> "Dec 13 2001 05:58PM"
> Whereas the same select statement in the MS SQL Query analyzer give:
> "2001-12-13 17:58:55.000"
>
> Since I need to be able to convert back and forth between datetime values
> and unix timestamps, I need to at least have the number of seconds
> (millisecs don't matter).
>
> Is this a problem in FreeTDS, or a limitation of the TDS protocol, or what?
> Is it possible to make FreeTDS always return the number of seconds in
> datetime fields?

Brad,

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.

To illustrate, try Microsoft's isql command-line tool. I think you'll
find it represents datetimes the way, say, sqsh does.

> (I don't want to use CONVERT, because the select statements in this
> application should remain portable)

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

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page