Cannot coerce value <> into type: class java.util.Date

I have a function to call midnight the day before the current day :

def getYesterdayStartOfDay(datetime):
return toDate(,month,yesterday),0,0,0))

And call the function as follows :

startDate = getYesterdayStartOfDay

The error I keep getting is :

Caused by: java.lang.ClassCastException: Cannot coerce value ‘<function getYesterdayStartOfDay at 0x6>’ into type: class java.util.Date

I have tried which results in “unparseable date”

You aren’t actually calling that function, you are assigning it to a variable.

Add open and close parenthesis at the end.

1 Like

Bit of a rookie mistake, thank you.