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


Adds an offset to a TIMESTAMP variable.


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


The timestamp to which Offset will be added


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


Indicates which part to add:

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

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


TIMESTAMP t1 = TimestampAdd(Tag1.T, 100); // 100 seconds
TIMESTAMP t2 = TimestampAdd(Tag1.T, 1, 0); // 1 year

See Also

Timestamp Functions