[ZODB-Dev] Date Conversion in Zope
enrica dente
enrica_dente at hotmail.com
Mon Jun 2 21:57:28 EDT 2003
Dear All
(Carissimi Colleghi - Aiuto!)
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.
Please help me.
Thanks
Enry
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
New findings:
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?
Thanks a lot for your help.
Enrica
_________________________________________________________________
Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile
More information about the ZODB-Dev
mailing list