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()+ 1900For 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
which in the comments showed a way to use the getFullYear() method.
When used this script it worked finevar 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
Post a Comment