Skip to main content Link Menu Expand (external link) Document Search Copy Copied

TIMESTAMP data type

TIMESTAMP() accepts any unix-epoch or ISO-8601 timestamp value.

These values are encoded by FeatureBase as a unix-epoch integer based on the chosen time-unit.

Before you begin




Argument Description Default Additional information
TIMESTAMP Data type that accepts unix epoch integer or string literal ISO-8601 timestamps   Time stamp converter
TIMEUNIT Time unit used to convert the value to unix-epoch timestamp s (second) TIMEUNIT values

Additional information


Time units are treated as string literals and require a single quotation mark.

Unit Declaration
seconds (default) s
milliseconds ms
microseconds us
nanoseconds ns


Implicitly convert integer to timestamp

Integer values inserted into a column with timestamp data type are converted to a value of seconds since the beginning of the unix epoch.

Demo table

create table demo
    (_id id, ts timestamp timeunit 's');

insert into demo(_id, ts)
    values (1, 0);
insert into demo(_id, ts)
    values (2, 86400);
insert into demo(_id, ts)
    values (3, 90061);
insert into demo(_id, ts)
    values (4, -86400);

SELECT() statement

select _id, ts from demo;


| _id |           ts                  |
| 1   | 1970-01-01 00:00:00 +0000 UTC |
| 2   | 1970-01-02 00:00:00 +0000 UTC |
| 3   | 1970-01-02 01:01:01 +0000 UTC |
| 4   | 1969-12-31 00:00:00 +0000 UTC |