Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getDay(),getMonth(),getYear()

I have a timestamp textField called $F{Fecha}, and I want to get from it the day,month, and year. I've create 3 variables var1,var2,var3 and in their expressions I've put the following $F{Fecha}.getDay(), $F{Fecha}.getMonth(),$F{Fecha}.getYear(); it gives me in return a value but they're wrong values,ie if my date is 20120118 it returns me day=3, month=0,yearh=112.

How can I do to fix this? Thanks in advance.

PD. I'm using iReport 4.0.0

like image 788
GuzZpaWn Avatar asked Oct 08 '22 22:10

GuzZpaWn


1 Answers

Here is a way to do it with Java expressions:

Day: new Integer($F{Fecha}.getDate())

Month: new Integer($F{Fecha}.getMonth()+1)

Year: new Integer($F{Fecha}.getYear()+1900)

like image 82
Tom Avatar answered Oct 13 '22 11:10

Tom