velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "john mahan" <john.ma...@isg.com>
Subject Velocity Date Calculations?
Date Tue, 02 Nov 2004 18:50:52 GMT
Using Velocity Template I have tried a variety of DateTool (and MathTool) coding approaches
without success (getting NULL result).

The objective is to calculate a Date object comprised of current date plus a variable number
of days that is converted to a string for display;

Here is an example of one approach I tried:


 ## -------- Set Min Date
     
     #set ($minDays = 2)  ## Earliest Day valid from Today (0= Today)
     ## ------  Set Initial Calendar Date For Display 
     #set ($minDaysMS = ($minDays * 1000 * 60 * 60 * 24))
     #set ($currDate = $date) ## Default Current System Date
     #set ($baseDate = $date.format('S',$currDate))
     #set ($minDateMS = ($baseDate + $minDaysMS))
     #set ($minDateDisp = $date.toDate($minDateMS))
     #set ($dateDisp = $date.format('M/d/yyyy',$minDateDisp))  ## Min Date Short String 

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I know this is (should be a simple thing) BUT since I'm new to Velocity any suggestions are
welcome.

John Mahan
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message