How to compare date with month in jasper reports

Hi

 

I have a requirement where in need to get month of the current date and compare it with interger.How is it possible in jasper?

if month(CurrentDate)>=7
    then year(CurrentDate)+1
else
    year(CurrentDate)

Could anyone help me on this date to interger comparision

?

Thanks in Advance

 

 

kiranmaisep6th's picture
Joined: Oct 20 2017 - 8:34am
Last seen: 5 years 5 months ago

 

I achieved this.

Integer.parseInt(new SimpleDateFormat("MM").format(new Date()))>=7?Integer.parseInt(new SimpleDateFormat("YYYY").format(new Date()))+1:
Integer.parseInt(new SimpleDateFormat("YYYY").format(new Date()))

kiranmaisep6th - 5 years 5 months ago

1 Answer:

Hello,

you can create a calculated field in AdHoc designer and use MonthNumber()  which returns month number. Please find more info on the calculated fields at the following URL.

Warm regards,

bojan.brajkovic's picture
Joined: Sep 11 2017 - 5:41am
Last seen: 4 years 6 months ago
Feedback
randomness