Cicode Programming Reference > Cicode Function Categories > Timestamp Functions > TimestampToTimeInt

TimestampToTimeInt

Converts a TIMESTAMP variable into a time INTEGER which is represented as a number of seconds since 01/01/1970.

Syntax

TimestampToTimeInt(TIMESTAMP Timestamp [, INT UTC])

Timestamp:

The timestamp variable.

UTC:

Coordinated Universal Time (optional):

0 – Returns the time as a local date/time.

1 – Returns the time as a UTC date/time (default)

Return Value

Time as a number of seconds since 01/01/1970 in UTC or local time depending on the last input parameter,-1 if invalid.

Related Functions

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

Example

TIMESTAMP t1 = TimestampCreate(2009,07,11,09,27,34,123);
INT TimeInt = TimestampToTimeInt(t1);
STRING sTimestamp = TimeToStr(t1, 0, 0);
// sTimestamp equals ‘9:27 AM’

See Also

Timestamp Functions

 

Published June 2018