Help with Data for Date...
Hi all... Its me again with more issues. <br />
<br />
I am building a report that will create a "projection" of information. This is based upon a frequency (freq) and a frequency unit (fut). I take a date field and named it nd. <br />
<br />
IE<br />
var nd = dataset.getTimestamp("date");<br />
<br />
Now the bottom forumla works, thank ****... but the problem is when I try to use a <strong class='bbc'>getFullYear</strong> function or a <strong class='bbc'>getMonth</strong> function. For some reason BIRT sees using the DateTimeSpan and converts Next0 into a String or something... Below is some of the output...<br />
<br />
var Next0 = new Date();<br />
<br />
var wk = -7 * freq;<br />
if (fut == "DAYS" && freq < 30)<br />
{<br />
Next0 = DateTimeSpan.addDate(nd,0,-1,0);<br />
}<br />
else if (fut == "DAYS" && freq > 29)<br />
{<br />
Next0 = DateTimeSpan.addDate(nd,0,0,-freq);<br />
}<br />
else if (fut == "MONTHS")<br />
{<br />
Next0 = DateTimeSpan.addDate(nd,0,-freq,0);<br />
} <br />
else if (fut == "YEARS")<br />
{<br />
Next0 = DateTimeSpan.addDate(nd,-freq,0,0);<br />
}<br />
else if (fut == "WEEKS" && freq < 5)<br />
{<br />
Next0 = DateTimeSpan.addDate(nd,0,-1,0);<br />
}<br />
else if (fut == "WEEKS" && freq > 4)<br />
{<br />
Next0 = DateTimeSpan.addDate(nd,0,0,wk);<br />
}<br />
<br />
Output:<br />
<br />
<br />
Mon Aug 17 10:31:37 PDT 2009 DEBUG DateNext0: Sat Apr 04 00:00:00 PDT 2009<br />
Mon Aug 17 10:31:37 PDT 2009 DEBUG DateNext0: Sat Apr 04 00:00:00 PDT 2009<br />
<br />
<br />
<br />
Now the issue is when I use the functions getFullYear or getMonth, BIRT states that the values are Null. So I tried converting the above into Date() functions... IE<br />
Next0 = new Date(DateTimeSpan.addDate(nd,-freq,0,0));<br />
etc.<br />
<br />
But when I try to view the date and the getfullyear it returns null and a NaN value in the getFullYear() function...<br />
<br />
Is there an easy way to convert the Next0 string to a date? <br />
<br />
I am currently on BIRT 2.1.2..<br />
<br />
Thanks in Advance<br />
Ben