I'm wondering if anybody know how to calculate the days betwen two dates or any way to loop betwen two dates
Alejandro Pancani wrote:
I'm wondering if anybody know how to calculate the days betwen two dates or any way to loop betwen two dates
You can use a syntax like this: <dtml-var "_.str(_.int(date1.earliestTime() - date2.earliestTime()))"> This isn't an absolute value ..you can put an _.abs (blabla) around the _.int to obtain an absolute value and check the dates with <dtml-if "date1.greaterThan (date2)"> .... to loop between two dates <dtml-let days="_.abs(_.int(date1.earliestTime() - date2.earliestTime()))"> <dtml-in "_.range(days)"> do your task here </dtml-in> I hope this helps azazel .
Example 1: Number of days between two dates: <dtml-var expr="_.DateTime('2001-02-01')-_.DateTime('2001-01-30')"> Example 2: Looping from certain starting date to 9 days after that: <dtml-in "_.range(10)"> <dtml-var expr="_.DateTime('2001-02-01')+_['sequence-item']"><br> </dtml-in> Alejandro Pancani wrote:
I'm wondering if anybody know how to calculate the days betwen two dates or any way to loop betwen two dates
_______________________________________________ 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 )
participants (3)
-
Alejandro Pancani -
aZaZel -
Luciano Ramalho