TIMESTAMP Data Type - Sybase SQL Anywhere to PostgreSQL Migration

In Sybase SQL Anywhere, the TIMESTAMP data type stores date and time with fractional seconds with microseconds precision.

In PostgreSQL, you can also use the TIMESTAMP(p) data type, allowing you to set a precision from 0 to 6 for fractional seconds, with a default of 6.

Sybase SQL Anywhere and PostgreSQL:

  -- Sample table 
  CREATE TABLE specs
  (
    item VARCHAR(30),
    created_dt TIMESTAMP
  );

Overview

Conversion summary:

Sybase SQL Anywhere PostgreSQL
Syntax TIMESTAMP TIMESTAMP[(p)]
Range 0 ⇐ p ⇐ 6
Date range 1600-02-28 to 7911-01-01 4713 BC to 294276 AD
Accuracy 1 microsecond 1 microsecond
Default p is 6

For more information, see Sybase SQL Anywhere to PostgreSQL Migration.