How i can to convert a Date that is null to String


I have this expression to display a date : 

($F{debut}== null ? " " :  DATEFORMAT($F{debut},"dd/MM/yyyy HH:MM"))

The problem is when the value of the date is null , there is an error message:

"Java.lang.string cannot be cast to" 

Even if i fill a message in my first condition, the same error appears.  



hervefranck1's picture
Joined: Jul 1 2021 - 5:05am
Last seen: 2 months 2 days ago

1 Answer:


Check the return type of the variable/parameter you are defining the expression may be returning a string here but the variable or parameter type is Date.  The return type needs to match the variable/parameter type to cast correctly.  



rmeadows's picture
Joined: Feb 10 2016 - 8:00am
Last seen: 3 weeks 4 days ago