[Zope] dates in dtml

Andy McKay andy@agmweb.ca
Wed, 31 Jul 2002 12:01:42 -0700


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