Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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 11:44 Go to next message
mkrivic Mising name is currently offline mkrivic Mising nameFriend
Messages: 33
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 14:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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

Jason
Re: Can't get year from date using getYear or getFullYear [message #658939 is a reply to message #658440] Thu, 10 March 2011 14:09 Go to previous message
mkrivic Mising name is currently offline mkrivic Mising nameFriend
Messages: 33
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:create a report in code
Next Topic:line breaks in pdf ?
Goto Forum:
  


Current Time: Fri Mar 29 07:16:06 GMT 2024

Powered by FUDForum. Page generated in 0.03524 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top