We want to subtract two dates in our Jython script and find out how many days have passed. Also, we would like to convert a date to a string that we can pass back to SQL to update the tables.
We are assigining a variable in our script a date from a component. We assume this is a python date type. When we called strftime on the date object we get a type mismatch error.
querydFill = event.source.parent.getComponent(‘calFillDate’).date
fpmi.db.runUpdateQuery(“UPDATE LookUpFermantationTanks SET ProjFillDate = ‘%s’ WHERE FERMTANKID = ‘%s’” % (querydFill.strftime("%Y-%m-%d %H-%M-%S"), keyValue1), ‘LabSNB01’)