[Zope] date-time manipulation

Marcus Collins mcollins@sunesi.com
Tue, 4 Apr 2000 09:22:11 +0200


Hi,

Your code is syntactically correct, but the ZopeTime() function has
sub-second precision. The result of subtracting one date object from another
is a floating-point number of days. Take the integer portion thus:

<dtml-if "_.int(ZopeTime() - created) == 14">
  <p>Time's up!
</dtml-if>

and you've got the number of full days that have elapsed.

There's a wealth of information on DateTime objects in
lib/python/DateTime/DateTime.html

hth,

-- Marcus

> -----Original Message-----
> From: mindlace [mailto:mindlace@imeme.net]
> Sent: 04 April 2000 03:09
> To: zope@zope.org
> Subject: [Zope] date-time manipulation
> 
> 
> Zopistas,
> 
> I have a date-time property called "created" in a dtml 
> document.  What I
> need to do is something like this:
> 
> 
> <dtml-if "(ZopeTime() - created) == 14days">
> <p>Time's up!
> </dtml-if>
> 
> How do I do this?
> 
> Thanks,
> 
> Ethan Fremen
> -- 
> http://mindlace.net __________________ mindlace@imeme.net
> I don't want The Truth but I wouldn't mind a Big Analogy.
> 
> _______________________________________________
> 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 )
>