[Zope] on dates

Cliff Ford Cliff.Ford at ed.ac.uk
Mon Oct 11 16:21:42 EDT 2004


Try this in the python script:

return DateTime(str(d)).strftime('%H:%M, %a %d %b, %Y')

It just produces the string representation of object d (to create a 
DateTime object). If d were already a DateTime object you would use:

return d.strftime('%H:%M, %a %d %b, %Y')

By way of comfort: I spent a lot of time trying to figure out how to 
work with dates and have a lot of sympathy with anyone going through the 
same process.

Cliff

massimop at users.berlios.de wrote:
> On Mon, 2004-10-11 at 20:59 +0100, Cliff Ford wrote:
> 
>>This bit of python:
>>
>>return DateTime(d).strftime('%H:%M, %a %d %b, %Y')
>>
>>giving this error:
>>
>> > Error Type: TypeError
>> > Error Value: int() argument must be a string or a number
>>
>>means that your item.data is neither an integer nor a string. You could 
>>try to find out what it contains. For example, if you put in this 
>>temporary line you should get the content:
>>
>>return d
> 
> this just returns the full date (es. 2004-10-11 19:14:47)
> 
> 
>>return DateTime(d).strftime('%H:%M, %a %d %b, %Y')
>>
>>Cliff
>>
> 
> 
> thanks for your patience
> massimo
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )


More information about the Zope mailing list