[Zope] Data date type returned by ZSQL method

Kapil Thangavelu kthangavelu@earthlink.net
Thu, 21 Sep 2000 18:10:48 -0700


Stuart Foster wrote:
> 
> I am trying to format a date value that is returned by a ZSQL method but
> keep getting an error.
> I am using the same format string where I use ZopeTime <dtml-var ZopeTime
> fmt="%m/%d/%Y">.
> Yet when I try to use it for a timestamp field from PSQL I get the following
> error.
> 
> Error Type: ValueError
> Error Value: unsupported format character 'm' (0x6d)
> 
> It sounds like the value being returned isn't a true date type?
> 
> Any clues?

guessing, cause i've been away from zope for a little while

your getting back a string from your sql method (the type is probably
date in the db but thats converted to string repr when you take it out
of the db), you need to convert it to a datetime object (ala
_.DateTime(string from db) )to get the formating you want.

reference lib/python/DateTime/DateTime.py for exact syntaxes allowed to
DateTime objects. 

cheers

kapil