Jump to content

One month before today?


Recommended Posts


isn't there a easy way in iReports to calculate the date one month back from today? Without calculating with milliseconds... and correct date with longer/shorterr months...

In SQL it's so easy (DateAdd(mm,-1,getDate()) - thats it), but I need a field with the date I've used in the SQL-statement...

Any solutions out there?



Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Perhapes I've just found another solution with readable code :-)

new Date().getMonth() in an integer-variable. Same for year and day, and calculating inside the variable expression (add or subtract days, month, years).

new Date().getYear() have to be added with 1900 to generate the current year (or subtract 100 for a two-digit year) - it's counting from 1900

But first tests gives a month one less the current, and a day one more than the current...? Hm, is there a counting too? how?...

christof, going on testing..

Link to comment
Share on other sites

  • 6 years 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...