One month before today?

0

Hi,

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?

thanks!

Christof

toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 11 months ago

2 Answers:

0

U can create a jar include ur own Date class. Then import it ireport. and use ur own class.

gocmenally's picture
Joined: Oct 3 2013 - 1:14am
Last seen: 6 years 2 weeks ago

thanks for the hint - I'll talk with our developer, perhapes he can include a ready made jar (calendar?)

toxy - 6 years 2 weeks ago
0

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

toxy's picture
36
Joined: Sep 11 2006 - 7:34pm
Last seen: 5 years 11 months ago
Feedback
randomness