[Zope] How do I format date/time in dtml from a ISO-8601 SQL timestamp field? field?

J Kinsley jkinsley@horus.bticc.net
Thu, 19 Oct 2000 21:05:54 -0400 (EDT)


I am probably missing something simple here, however I can not get
this to work properly....

Given mtime = YYYY-MM-DD HH:MM:SS-ZZ as returned from PostgreSQL, how
do I get the following to work without errors?  

<dtml-in "sqlquery(...)">
 ....
 <dtml-var mtime fmt="%a %d %b %Y %H:%M:S %Z">
 ....
</dtml-in query>

This returns:
Errot Type:  ValueError
Error Value: unsupported format character 'a' (0x61)


If i drop the %a from the fmt string as follows:

<dtml-in "sqlquery(...)">
 ....
 <dtml-var mtime fmt="%d %b %Y %H:%M:S %Z">
 ....
</dtml-in query>

I get the following Zope Error:
Error Type:  Type Error
Error Value: illegal argument type for built-in operation

Mtime was initially declared as a string in the ZSQL Method arguments
list, and changing it to date had no effect.  I have searched the
documentation and all examples I have found that use strftime
formatting indicate that this should work.  I have successfully been
able to change the format using the to_char(mtime) PostgreSQL
function, but then order by mtime does not work properly and besides,
I would like to make the format style customizable from within Zope
instead of on the SQL server.


Thanks in advance for any suggestions....

Regards,
Jarrod Kinsley