[Zope] formatting a date string

Graham Chiu anon_emouse@hotmail.com
Mon, 6 Mar 2000 08:05:25 +1200


In article <Pine.SOL.4.10.10003051220140.12597-100000@argyle>, Jeff
Hoffman <jeff.hoffman@goingv.com> writes
>> I have a variable called START returned by a sqlquery
>> 
>> <dtml-call "REQUEST.set('startdate',START)">
>> start is <dtml-var startdate>
>
>Is START being returned as a string, or as a DateTime from your query? If
>it's being returned as a string, you need:
>
>  <dtml-call "REQUEST.set('startdate', _.DateTime(START))">
>
>> and that's okay
>> 

It all seemed to work when I tried this

<dtml-call "REQUEST.set('startdate',_.str(START))">


>> <dtml-call "REQUEST.set('month',_.DateTime(startdate).aMonth">
>> 
>> That, and variations of the same, dies with
>> 
>> Error Type: TypeError
>> Error Value: __div__ nor __rdiv__ defined for these operands
>
>aMonth() is a method, not an attribute. You need to _call_ it, i.e.:
>
>  <dtml-call "REQUEST.set('month', _.DateTime(startdate).aMonth())">

It works as written

<dtml-call "REQUEST.set('month',_.DateTime(startdate).aMonth">

thanks for the response.

-------
Regards,        Graham Chiu
gchiu<at>compkarori.co.nz
http://www.compkarori.com/dynamo - The Homebuilt Dynamo
http://www.compkarori.com/dbase - The dBase bulletin