Jump to content

How to calculate difference between two dates and use as grouping


sszretter

Recommended Posts

 In JasperReports (iReport), how can I take a date field from the database and calculate the difference between that and the current date (for example to calculate age) and then GROUP the report on that value (age 18 group, age 19 group/break, etc.)?

date field in iReport:

$F{dob}
[/code]

example of how I calculate the age - at least to display it on the report, but I want to break on this value somehow:

<![CDATA[theDate=new Date($F{dob});  currentDate=new Date(); Math.round((currentDate.getTime()-theDate.getTime())/1000/60/60/24/356)]]>
[/code]

Thanks!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...