Cicode Programming Reference > Cicode Function Categories > Timestamp Functions Introduction > TimestampSub

TimestampSub

Subtracts an offset from a TIMESTAMP variable.

Syntax

TimestampSub(TIMESTAMP Timestamp, INT Offset [, INT Part])

Timestamp:

The timestamp to which Offset will be subtracted

Offset:

The offset to subtract, expressed in units of the part parameter

Part:

Indicates which part to subtract:

0 – Offset is in years.

1 – Offset is in months.

2 – Offset is in days.

3 - Offset is in hours.

4 - Offset is in minutes.

5 - Offset is in seconds (default)

6 - Offset is in milliseconds

Return Value

The TIMESTAMP variable, or INVALID_TIMESTAMP if invalid.

Related Functions

TimestampAdd, TimestampCurrent, TimestampDifference, TimestampToStr, TimestampCreate, TimestampFormat, TimestampGetPart, TimestampToTimeInt, TimeIntToTimestamp

Example

TIMESTAMP t1 = TimestampSub(Tag1.T, 1, 0); // 1 year;

See Also

Timestamp Functions