Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Can't get year from date using getYear or getFullYear
Can't get year from date using getYear or getFullYear [message #658406] Tue, 08 March 2011 06:44 Go to next message
mkrivic Mising name is currently offline mkrivic Mising name
Messages: 32
Registered: May 2010
Member
Hi,

In scripted dataset, fetch method, I have the following code:

if(index == 1){
return false;
}
else{

row["Today"] = "2011.03.07";
row["Day"] = row["Today"].getDate();
row["Month"] = row["Today"].getMonth() + 1;
row["Year"] = row["Today"].getYear();
index++;
return true;
}

For rows row["Day"] and row["Month"] I get values that I need (07 and 03), but for row["Year"] I get 111.
When I try to use getFullYear instead of getYear, I get error about this function not defined!

Any idea how to get year from date in this way?

Help needed ASAP!


Re: Can't get year from date using getYear or getFullYear [message #658440 is a reply to message #658406] Tue, 08 March 2011 09:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Try:
row["Today"].getYear() + 1900;

Jason


Jason Weathersby

BIRT Exchange
Re: Can't get year from date using getYear or getFullYear [message #658939 is a reply to message #658440] Thu, 10 March 2011 09:09 Go to previous message
mkrivic Mising name is currently offline mkrivic Mising name
Messages: 32
Registered: May 2010
Member
Hi Jason,

Thanks for reply. Your suggestion works fine, but I found another way before your reply:

BirtDateTime.year(row["Today"]);

and it also works!

Anyway, thanks
Previous Topic:Cannot call a function when creating a dataset
Next Topic:line breaks in pdf ?
Goto Forum:
  


Current Time: Mon Apr 21 11:48:47 EDT 2014

Powered by FUDForum. Page generated in 0.01863 seconds