Date Looping

Description

This is how you can loop over a range of dates in velocity

Code

#set($start = $date.toDate("MM/dd/yyyy","02/25/2013"))
#set($end = $date.toDate("MM/dd/yyyy","03/10/2013"))

## D = Day of Year
#set($startDOY = $date.format("D", $start))
#set($endDOY = $date.format("D", $end))
#set($days = $math.abs($math.sub($startDOY, $endDOY)))

<p> There are $days days between $date.format("MM/dd/yyyy", $start) and $date.format("MM/dd/yyyy", $end) </p>

<ul>
#foreach($d in [0..$days])
  <li>The date: $date.format("MM/dd/yyyy", $UtilMethods.addDays($start, $d))</li>
#end
</ul>