It troubles me that no one has had an answer to this so far.
I tried asking roughly the same question of the velocity-users list and
was told that a new version of Velocity now does arithmetic with
non-integer numbers, but two things make that problematic: first, I
have limited access to the server to install software; second, I can't
believe that no one in all of XWiki's lifetime has ever tried to do any
date calculations, such as the difference of two dates, or
adding/subtracting intervals.
Isn't there an easier way to do this? All I want to do is decide
whether something's a week old.
brain[sic]
-----Original Message-----
From: THOMAS, BRIAN M (SBCSI)
Sent: Friday, March 03, 2006 5:18 PM
To: xwiki-users(a)objectweb.org
Subject: [xwiki-users] Long arithmetic...?
It seems that a Velocity #set directive fails when the RHS involves any
arithmetic operation with long integers.
Specifically, I just wanted to determine the difference between two
dates, thus:
#set ($age = $xwiki.currentDate.time -
$obj.xWikiObject.getDateValue("donedate").time)
I confirmed that I got credible results from both of the operands by
printing them, and I could assign either of them to another variable
name, but setting $age to the result of any arithmetic operation with
any of them always gave "$age" as the formatted result.
This shouldn't be this hard, should it?
brain[sic]