Hello. I have a java.sql.Timestamp object in a python script being executed by the python engine of ExecuteScript. As has been explained to me, the underpinnings of this appears to be jython.
I need to get YYYY, MM, and DD from this java.sql.Timestamp object, ,myDT. I've done research and discovered that the trick to doing this is to first take your timestamp object and put it into a Calendar object. Like this (credit StackOverflow, https://stackoverflow.com/questions/6262570/how-to-retrieve-day-month-and-year-from-timestamplong-format ): Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(myDT);return cal.get(Calendar.YEAR); In an effort to do this I must import the Calendar class. I tried this: import java.util.Calendar and it failed, and I tried this import Calendar and it failed. Error thrown by NiFi is this: org.apache.nifi.processor.exception.ProcessException: no viable alternative at input 'cal' in script at line number How do I get the year from my timestamp object in python code running in an ExecuteScript processor that employs jython? Thanks very much.