[Zope] Zope Date format conversion problem

Dylan Reinhardt zope at dylanreinhardt.com
Thu Oct 9 02:52:40 EDT 2003


On Wed, 2003-10-08 at 23:33, Andreas Jung wrote:
> or use  name="date2:date" in the input form.

I'm not a big fan of putting the client in charge of declaring your data
types.  But I'll spare everyone another iteration of *that* rant. :-)

Thinking about it some more, if you *know* you just want to translate
one format to another, a two-line Python script will do the trick:

---------
# date2 passed in as a parameter
# 'MM/DD/YYYY' -> 'YYYY/MM/DD'
d = date2.split('/')
return '/'.join(d[2],d[0],d[1])
---------

If you want to do additional validation or formatting, obviously you'll
need more than this.

HTH,

Dylan





More information about the Zope mailing list