Hi I'm trying to convert a date that's extracted from a database into a date accepted by zope. Then I'm setting this in a variable using REQUEST.set so I can compare it to other dates. I always get errors with this and it's not clear how I should be doing it. I resorted to using dtml-let in order to split things up a bit, and avoid <dtml-call "REQUEST.set('first_date', oldest(item=_.DateTime(_.getitem('START_TIME')).aCommon(), old=_.getitem('START_TIME'))"> Which is really long and hard to understand. Is there any documentation where anyone explains how to use _. functions within dtml, or how zope can compare dates? Thanks Ale -- Alejandro Fernandez Electronic Group Interactive --+34-65-232-8086-+34-93-600-2338--
Ugh, the real solution is to use a Python Script. It will be a lot simpler.
Which is really long and hard to understand. Is there any documentation where anyone explains how to use _. functions within dtml, or how zope can compare dates?
_. is just Python. Look at the DateTime reference in the online help for information on comparing dates. Its a simple matter of comparing the two. For example:
from DateTime import DateTime time1 = DateTime() time2 = DateTime() time1 > time2 # is time 1 greater? 0
-- Andy McKay @gmweb Consulting http://www.agmweb.ca ----- Original Message ----- From: "Alejandro Fernandez" <ale@e-group.org> To: <zope@zope.org> Sent: Wednesday, July 31, 2002 1:47 AM Subject: [Zope] dates in dtml
Hi
I'm trying to convert a date that's extracted from a database into a date accepted by zope. Then I'm setting this in a variable using REQUEST.set so I can compare it to other dates. I always get errors with this and it's not clear how I should be doing it. I resorted to using dtml-let in order to split things up a bit, and avoid
<dtml-call "REQUEST.set('first_date', oldest(item=_.DateTime(_.getitem('START_TIME')).aCommon(), old=_.getitem('START_TIME'))">
Which is really long and hard to understand. Is there any documentation where anyone explains how to use _. functions within dtml, or how zope can compare dates?
Thanks
Ale -- Alejandro Fernandez Electronic Group Interactive --+34-65-232-8086-+34-93-600-2338--
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Alejandro Fernandez writes:
... Is there any documentation where anyone explains how to use _. functions within dtml The only information you need is what functions are available (you find this in the Zope embedded online help under Zope Help --> DTML). You use them in the same way, you use all functions: i.e. you call them.
, or how zope can compare dates? Please read the "DateTime" documentation (to be found in the "DateTime" folder).
Dieter
participants (3)
-
Alejandro Fernandez -
Andy McKay -
Dieter Maurer