Date Items

 When trying to insert a date value from a parameter onto a chart in Birt Reports, I was having difficulty extracting the year from the date parameter.  It seemed that the javascript function getFullYear() didn't work.  To get around that I did the following:

paramEndDate.getYear()+ 1900

For some odd reason when you use the getYear() method it subtracts 1900 from the value, so you have to add it back in.

I found this link which noted this as a bug

   https://bugs.eclipse.org/bugs/show_bug.cgi?id=244348  

which in the comments showed a way to use the getFullYear() method.

When used this script it worked fine
var titleYear = new Date(paramStartDate.getTime()).getFullYear();
var titleStartDate =  (paramStartDate.getMonth() + 1) + "/" + paramStartDate.getDate() + "/" +  titleYear;


How to subtract days from a date or today in a text element

d = BirtDateTime.addDay(BirtDateTime.today(), -7); 
Hope this helps someone that may need it.

Comments

Popular posts from this blog

Installing Birt Reports

Global Variables

Display Parameter Text