SUB_TIMESTAMP

Use the SUB_TIMESTAMP script function to subtract time from a timestamp. You can subtract up to 99 hours, minutes, and seconds, giving a maximum range of just over 4 days before the original timestamp. The calculation uses UTC and does not account for Daylight Saving Time or Standard Time changes.

Tip: Use SUB_DAYS when you need to subtract whole days from a date.

Syntax

SUB_TIMESTAMP (Timestamp,Time)

Parameters

Parameter Description Format Allowed Values
Timestamp Timestamp to subtract time from, in YYYY-MM-DD HH:MM:SS format. script literal or script variable n.a.
Time Amount of time to subtract, in HH:MM:SS format. script literal or script variable 0 to 99 for each of HH, MM, and SS

Return Codes

The SUB_TIMESTAMP function returns a timestamp in YYYY-MM-DD HH:MM:SS format.

Examples

The following example subtracts one second from the timestamp and prints the result (2018-12-31 23:59:59) in the activation report.

: SET &RET# = SUB_TIMESTAMP ("2019-01-01 00:00:00""00:00:01" )

: PRINT &RET#

See also: