SwapSQL

MySQL → PostgreSQL

Convert MySQL DATETIME to PostgreSQL timestamp

MySQL DATETIME stores a wall-clock value with no time zone. The matching PostgreSQL type is timestamp (without time zone); zero dates need special care.

DATETIME timestamp

What to know

Before / after

MySQL

CREATE TABLE orders (
  placed_at DATETIME(6) NOT NULL
);

PostgreSQL

CREATE TABLE orders (
  placed_at timestamp(6) NOT NULL
);

Don't convert column-by-column — convert the whole database.

Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.

Open the MySQL → PostgreSQL converter

See the full type mapping table or all guides.