[Zope] Time fields in MSSQL/ODBC (urgent!)

Alexander Staubo alex@mop.no
Mon, 14 Jun 1999 21:42:22 +0200


I am using the ODBC DA to connect to Microsoft SQL Server 6.5. I've
encountered this problem before and never found a solution.

Doing a simple

  select ArticleTime from Articles

where ArticleTime is my datetime column, I get:

  Error Type: ValueError
  Error Value: Invalid value, 1999-04-29 21:36:00.000, for ArticleTime
in record 0

Iirc, DateTime() barfs if a time zone is omitted in the string, so
"1999-04-29 21:36:00.000" would not be a valid value, whereas
"1999-04-29 21:36:00.000 GMT+1" would be. Now, naturally I can do
something like

  select convert(varchar(12), ArticleTime) + 'GMT+1' as ArticleTimeStr
from Articles

which will convert the column into a string value, more or less, and I
can then feed the string back into DateTime using an External Method.
Phew. But of course I'd like to avoid this kind of coding.

Anything I can do to make Zope accept these datetime values?

--
Alexander Staubo             http://www.mop.no/~alex/
"`This must be Thursday,' said Arthur to himself, sinking low over
his beer, `I never could get the hang of Thursdays.'"
--Douglas Adams, _The Hitchhiker's Guide to the Galaxy_