Skip to main content



      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 06:44 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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 09:09 Go to previous message
Eclipse UserFriend
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: Thu Jul 24 19:33:59 EDT 2025

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

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

Back to the top