Search code examples
javaapachevelocity

I am very new to velocity apache script


Present code is am using is like this:

#set($startdate=$datetool.format("yyyymmdd",$fromDate))

#set($enddate=$datetool.format("yyyymmdd",$endDate))

But I dont know how to continue. I want to find out difference between two dates which are in the format yyyymmdd, and if the difference is greater than one month, I have to divide that into months, so please anyone help to solve this.


Solution

  • I Would suggest you to to use ComparisonDateTool in Velocity to get date difference

     $dateComparisonTool.difference($startdate,$enddate).days