Operating on datetime variables natively

I am trying to use datetime variables but the limitations of Automise are becoming frustrating.

  1. Two variables, both datetime
  2. 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.”
  3. 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).
  4. Now the If… works
  5. 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.
  6. 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?

I’m not exactly sure why this wasn’t done before (possibly due to the pre-at5 variables architecture limitations), but I have added support for datetime comparisons without conversion to string to the If…Then action and the Fileset datetime filter.

Note these only work when the value is a simple variable reference (with no other text) and the variable types are both set to DateTime.

http://downloads.finalbuilder.com/downloads/automise/500/AT500_1109.exe
http://downloads.finalbuilder.com/downloads/automise/500/ATCMD500_1109.exe
http://downloads.finalbuilder.com/downloads/automise/500/AutomiseRunner500_1109.exe

Thanks, that’s a very quick response! I’d feel more comfortable applying the update if all actions that can do comparisons on datetime variables were converted, as it will be difficult to remember what supports the improvement and what doesn’t.

We have reviewed all the actions and the only other one that was affected was the set variable action

http://downloads.finalbuilder.com/downloads/automise/500/AT500_1113.exe
http://downloads.finalbuilder.com/downloads/automise/500/ATCMD500_1113.exe
http://downloads.finalbuilder.com/downloads/automise/500/AutomiseRunner500_1113.exe

The previous build introduced a regression in the set variable action, this build has the fix for that

http://downloads.finalbuilder.com/downloads/automise/500/AT500_1114.exe
http://downloads.finalbuilder.com/downloads/automise/500/ATCMD500_1114.exe
http://downloads.finalbuilder.com/downloads/automise/500/AutomiseRunner500_1114.exe

Just discovered this thread as I was looking to add a day to a given date variable, and found I could not do it. Does this enhancement allow for that as well as the straight comparison of dates?

No, see my reply to the other post about this.