Date Conversion in Zope

enrica dente enrica_dente at
Mon Jun 2 17:16:42 CEST 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.

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

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

Stay in touch with absent friends - get MSN Messenger

More information about the Python-list mailing list