Jump to content
Changes to the Jaspersoft community edition download ×

Return a specfic Date


tgustafson

Recommended Posts

Good Morning,

I'm new to Jaspersoft and trying to figure out how to return a specific date.  I have a report that gets created letting customer know when our next meeting is.  I need to return the 3rd Wednesday of December each year.  Has anyone done something like this?

Thanks,

Terry

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This is just a Java question and not a JasperReports question.

Anyways, enter something like below in your text field replacing "2017" with the year you want

java.time.LocalDate.of(2017, 12, 1).with(java.time.temporal.TemporalAdjusters.nextOrSame(java.time.DayOfWeek.WEDNESDAY)).with(java.time.temporal.TemporalAdjusters.next(java.time.DayOfWeek.WEDNESDAY)).with(java.time.temporal.TemporalAdjusters.next(java.time.DayOfWeek.WEDNESDAY))

Link to comment
Share on other sites

  • 2 weeks later...

If you are using Java 8 then you can import following classes in your report:

java.time.DayOfWeek;
java.time.LocalDate;
java.time.Month;
java.time.temporal.TemporalAdjusters;

and use expression similar to below by replacing year with current year or any parameter

LocalDate.of(2017, Month.DECEMBER, 10).with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.WEDNESDAY));

 

Link to comment
Share on other sites

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...