Jump to content
We've recently updated our Privacy Statement, available here ×

Get the current year


memory721

Recommended Posts

Hello,

I need to somehow show this statement at the bottom of each report:

©2007 - 2010 Company, Inc. All Rights Reserved.

 

I need to have the 2010 year as a variable that will change as the year changes.  How do I set this up?  I was thinking to create a parameter and set the parameter class to java.util.date. My next step was to drag the parameter onto the design layout and right click to edit expression.  This is where I get lost.  I know that I somehow have to use Year(GetDate()) in this, but I really don't know where.  And how do I insert that into the above text?  Do I use a text box from the Palette to insert that info first and then insert the year parameter into it?

Really appreciate the help!

Thank you.

Memory721

 

 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

welcome in IReport community...

I suggest to you to learn some java and ireport basics...

what you ask is really simple but without basic notion seems to be very hard to do :)

try this:

-create a variable... call it year ( :) ) of type String, leave all parameters at default values except the espression, setting it to:
(new SimpleDateFormat("yyyy")).format(new Date())

-now create a textfield in your report, of type String and set the expression to:

"©2007 - "+$V{year}+" Company, Inc. All Rights Reserved."

and run the report...

 

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

 

Link to comment
Share on other sites

  • 1 year later...

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