I am trying to use datetime variables but the limitations of Automise are becoming frustrating.
- Two variables, both datetime
- If compared using If…, they are converted to string before comparison. The online help says “Use %VariableName% syntax to compare the values of variables. String, integer or floating point values can all be compared.”
- To work around this, I can set the format string to “yyyy-mm-dd hh:nn:ss” (noting that the default format is “c”, which is locale-dependent so could be different for different installations).
- Now the If… works
- Subsequently, in a “Fileset define” action I have a filter that restricts files to ones that have been created after a date specified by the variable.
- This fails with the following error:
“Error converting string to date/time: ‘2019-08-23 16:16:40’ is not a valid date and time”
So the formatting has broken this comparison. It is as if all datetime variables are converted to string before comparison but the fileset doesn’t recognise the format.
Can datetime be supported natively for comparisons?