Jump to content

Comparing dates in text field expression


Saquibhasan2007

Recommended Posts

I have a declared a date parameter end_date of data type date and I am passing a date value to it which needs to be compared with certain other date, say '2014-10-31' and based on this the output needs to come.. I have tried all of the following in the text field expression but the logic doesnt seem to work. Either there is compilation error or error in evaluating expression.

($P{END_DATE} > '2014-10-31' ) ? 'Right' : 'Wrong'

($P{END_DATE}.getDate() > ('2014-10-31').getDate() ) ? 'Right' : 'Wrong'

($P{END_DATE}.getDate() > '2014-10-31') ? 'Right' : 'Wrong'

Please help.. Thank You in advance

Link to comment
Share on other sites

  • 11 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 4 weeks later...

solved with

 

new Date().parse("yyyy-MM-dd",$F{my_date}.toString()).format("yyyy-MM-dd")  >>>> if your date variable is a string.

>=

new Date().parse("yyyy-MM-dd",$P{report_date}).format("yyyy-MM-dd")    >>>>>  here the function .toString() is not necessary when you date is a Date Type variable

 

;)

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...