"Cannot convert expression from Number to DateTime." warning returned when trying to compare a date field with DateAdd function value in $IF() expression.

Version 1

    Details

    - Trying to use an expression like the following  to convert a specific date to a date that can be used in an if statement for < or > another DateTime field.

    $(if CreatedDateTime < DateAdd("day",  1,  '2014-11-10')  then "True"  else "False")

    When saving you get a Warning:
    The value 2014-11-10 cannot be used where a DateTime value is expected.

    - If you change the value '2014-11-10' to different formats; 11/10/2014, 11-10-2014, 2014/11/10, Each test surrounding with; '_' OR "__"
    - When just using the value you get the following warning:
    Cannot convert expression from Number to DateTime.


    Resolution

    You need to use the type Conversion 'DateTime' function in the DateAdd part of the expression.

    For Example:


    $(if CreatedDateTime < DateAdd("day",  1,  DateTime("2014-11-10"))
      then true
      else false)