I have a function to call midnight the day before the current day :
def getYesterdayStartOfDay(datetime):
year=system.date.getYear(datetime)
month=system.date.getMonth(datetime)
today=system.date.getDayOfMonth(datetime)
yesterday=today-1
return toDate(system.date.setTime(system.date.getDate(year,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 system.date.parse(getYesterdayStartOfDay) which results in “unparseable date”