This page is about the Time - Timestamp in Sql datatype.
A TIMESTAMP contains the following <datetime field>s:
TIMESTAMP [ <left paren> <timestamp precision> <right paren> ] [ WITH TIME ZONE ]
The precision may be also called the scale (ie DECIMAL_DIGITS in JDBC) and should not be confound with the scale or precision of a numeric.
A value of the timestamp scale (ie precision), result in a specific (precision, scale) tuple. See scale_versus_precision_scale_tuple
The literal TIMESTAMP '1970-01-01 00:00:00' has in the database the value 0.
insert into fact (ts) values TIMESTAMP '1970-01-01 00:00:00';
timestamp string in SQL
Example:
yyyy-mm-dd hh:mm:ss.s
where:
Specified scale | Result (precision, scale) | Column length (bytes) | Fractional seconds precision |
---|---|---|---|
timestamp | (34,7) with time zone | 10 | 7 |
timestamp(0) with time zone | (26,0) | 8 | 0-2 |
timestamp(1) with time zone | (28,1) | 8 | 0-2 |
timestamp(2) with time zone | (29,2) | 8 | 0-2 |
timestamp(3) with time zone | (30,3) | 9 | 3-4 |
timestamp(4) with time zone | (31,4) | 9 | 3-4 |
timestamp(5) with time zone | (32,5) | 10 | 5-7 |
timestamp(6) with time zone | (33,6) | 10 | 5-7 |
timestamp(7) with time zone | (34,7) | 10 | 5-7 |