[Zope] DateTime inside an in loop

Dieter Maurer dieter@handshake.de
Sat, 23 Jun 2001 22:36:15 +0200 (CEST)


Neil Burnett writes:
 > I want to use DateTime on a date value returned in a ZSQLMethod.
 > 
 > E.g. Say the SQL for get_records() ZSQLMethod is
 > 
 > SELECT ID, adate FROM DateValues
 > 
 > I want to do something like this:
 > 
 > <dtml-in expr="get_records()">
 > <dtml-var ID>
 > <dtml-var expr="_.DateTime(adate).strftime('%d-%b')">
 > </dtml-in>
 > 
 > I have tried all sorts of syntax to get a result, with no result.
 > 
 > Question 1: Can someone tell me the correct syntax please?
Your syntax is good.

But, if your field "adate" is defined as a date in your
table, it probably is already a "DateTime" object.
Try to remove the "_.DateTime(...)", just use "adate".

 > Question 2: Can someone 'teach me to fish' by showing me the path to some
 > documentation on namespaces? I have searched and read a fair amount today
 > without actually getting enlightenment:-(
The Zope book or

  URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html



Dieter