How to Add Days, Months and Years in a Jaspersoft Report

17 May 2017
by DynasoftUSA Staff

You can add days, months and years to a DATE field by using the following  workaround in Jaspersoft reports.

 

  1. Manually add the following content in the jasper xml

<import value=”org.apache.commons.lang.time.*”/>

 

  1. Use the following syntax as given in the below example:

 

To add Days – DateUtils.addDays($F{HIREDATE},5)  – Return type date

 

To add Months – DateUtils.addMonths($F{HIREDATE},5)  – Return type date

 

To add Years – DateUtils.addYears($F{HIREDATE},5)  – Return type date