Calculation problem when using the VBScript “Now” function in conjunction with the “DateDiff” function within a condition

Note: This article applies to transition and additional notification conditions.

Issue

The Now function will return the current local time of the Windows machine and is used to compare to a GMT DateTime from the <WF_ACTIVITY_INST_LIMIT_DATETIME> macro.

The time difference could be several hours off depending on the local machine’s time zone setting, which may result into an incorrect or false condition evaluation. This is only true in WorkflowGen versions 5 and later, since the introduction of the time zone management feature. This is a DateTime calculation issue and not a software bug.

Solution

The solution is to use the <WF_SYSTEM_DATETIME> macro instead of the VBScript Now function.

Example

DateDiff("d",<WF_ACTIVITY_INST_LIMIT_DATETIME>,<WF_SYSTEM_DATETIME>) > 2