Jump to content
We've recently updated our Privacy Statement, available here ×

Extract Month & Year from Date column as Calculated Field


aluferrari

Recommended Posts

Hi,

We are looking to create a new calculated field by extracting Month and Year (in 2 separate fields) from a column containing Date values. We have tried many things but nothing seems to be working.

We are on Oracle database and we have tried all TO_DATE functions and TO_CHAR functions but in vain. Please help us with correct syntax of DoMEL to achieve what we want.

Thanks in advance.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Thanks for the answer. We are aware of these functions in Oracle, but how do we add them in Jasper? Here is some background:

Our Employee table has hiredate column. We want to create a cross tab report that would show month-wise & year-wise employees hired.

 

Thanks again.

 

Link to comment
Share on other sites

Hi,

Your query may be:

select

To_char( hiredate, 'MONTH') as Month,

To_char( hiredate, 'YYYY') as Year,

To_char hiredate, 'Month YYYY') as YearMonth 

from Employee

This may be your query, used month, year or  YearMonth in crosstab whichever suits your reporting requirement.

Thanks

Ajinkya

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...