26 Apr
2000
26 Apr
'00
8:45 p.m.
Andrew Diller wrote:
Here is my contribution. I create a date attribute called targetdate that people modify. I want to have a simple integer on a page showing how many days from _now_ till that 'target date.'
Here is my snipped that works: (thanks to the previous posts)
<dtml-let now="ZopeTime()"> <dtml-let due="targetdate"> <b><dtml-var "_.int(_.round(due-now))"></b> </dtml-let></dtml-let>
One caveat here: the rounding won't be correct if you have anything to do with daylight-savings time in your machine's timezone, or in the time you're storing. It will most likely be an hour out. See other posts to the list about problems with DateTime and daylight savings. -- Steve Alexander Software Engineer Cat-Box limited