[Zope] problem with european date parsing

Oliver Frommel oliver@aec.at
Sat, 31 Mar 2001 13:30:26 +0200 (CEST)


Hello,

I encountered a problem when trying to use european date format with Zope.
When I pass a value:date from a form to dtml or python script, Zope tries
to parse this value. However when the date format is ambigous it swaps month
and date, i.e. when I have a date 1.2.2001 (first of february) Zope makes this
2.1.2001 internally. So I was using a python script which assumes that Zope
does this and swap the values myself:

in dtml:

<dtml-call "REQUEST.set('date', swapmd(inputdate))">

with python script (param date):
return DateTime(date.year(), date.day(), date.month())

now when date.day() is bigger than 11, Zope _does_ parse the date correctly.
This lead to my new script:

if date.day() > 11:
	newdate = DateTime(date.year(), date.month(), date.day())
else:
	newdate = DateTime(date.year(), date.day(), date.month())
return newdate

which is somehow ugly and may fail neverthelesse ..
So is there a way to supply a format string to Zope to make it parse my 
Date correctly (similar to output "%d.%m.%Y" e.g.)??

thanks for your help
--Oliver