Date Conversion in Zope

enrica dente enrica_dente at hotmail.com
Mon Jun 2 11:16:42 EDT 2003


Dear All,

Does anyone know how to convert a date from format DD/MM/YYYY into format 
YYYY/MM/DD using Python in Zope?

I get a string date from an input box named EventDate which I then need to 
pass to a <dtml-var> so that I can then convert its format. The lines of 
code I've wrotten give the errors below.


1)
<dtml-call "REQUEST.set('EventDate', fmt='%Y/%m/%d')">
Error Type: TypeError
Error Value: __setitem__() got an unexpected keyword argument 'fmt'

2)
<dtml-call "REQUEST.set('event_date', 'EventDate.strftime(%d/%m/%Y)'">
Expression (Python) Syntax error:
unexpected EOF while parsing

The code I have found on Zope.org works ony  if you accept in the imput box 
the american date format (MM,DD,YYYY) and not (DD,MM,YYYY).

In the form:
<input type="text" name="EventDate:date" size="25">

In the DTML method:
<dtml-call "REQUEST.set('EventDate', EventDate.strftime('%Y/%m/%d'))">

How do I change EventDate into the (DD,MM,YYYY) format?

Please help me.
Regards
Enrica

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger






More information about the Python-list mailing list