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

0

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 java.util.date" 

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:

0

Check the return type of the variable/parameter you are defining the expression on...you 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.  

 

Thanks.

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