Command time.calculate

The command time.calculate is used to calculate time. It supports addition, subtraction and difference.

Parameters

  1. date [string]
    Date that will be changed or that will be used in comparison by the operation difference.
  2. greaterdate [string]
    Greater date that will be used by the difference operation. On sum and less operations this variable is not used, but an empty value should not be used, or a POSXML error might occur.
  3. operation [string]
    Operation type, which can be: sum, less or difference.
  4. type [string]
    Unit of time to be calculated: years, months, days, hours, minutes or seconds.
    On a difference operation this variable is not used, but an empty value should not be used, or a POSXML error might occur.
  5. value [integer]
    Value to be added or subtracted (only for operations sum and less).
  6. variablereturn [integer]
    If the operation is difference, the value of the difference is returned. Is case of an sum or less operation the result is:
    0: Success
    -1: Error.

Example


In the example above, there are three operations: difference, sum and less.

The first operation performed is difference, where the content of the variable sDate1 is compared with the content of the variable sDate2, and the difference between them is returned in seconds and stored on variablereturn.

The second operation performed is sum, where 10 hours is added on the date stored on sDate1. If the operation is successfully executed, the variable variablereturn receives 0, and the date stored on sDate1 will be increased by 10 hours.

The third operation performed is less, where 10 minutes is subtracted from the date stored on sDate1. If the operation is successfully executed, the variable variablereturn receives 0, and the date stored on sDate1 will be decreased by 10 minutes.