[Zope] DateTime inside an in loop

Neil Burnett neil@efc.be
Sun, 24 Jun 2001 00:32:27 +0200


> -----Original Message-----
> From: Dieter Maurer [mailto:dieter@handshake.de]
> Sent: 23 June 2001 22:36
> To: Neil Burnett
> Cc: zope@zope.org
> Subject: Re: [Zope] DateTime inside an in loop
>
>
> 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".

Yes it is a date string, but I need to format it to be easy to read. I
assumed I could do that with DateTime.


>  > 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

The version I have doesn't help. I'll download the latest.

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

Lots of good reading there, thanks.

>
> Dieter