PostgreSQL → MySQL
Convert PostgreSQL timestamptz to MySQL
MySQL DATETIME stores no time zone, so timezone-aware values must be normalized. The safe convention: convert everything to UTC during migration.
timestamptz → DATETIME(6)
What to know
- timestamptz → DATETIME(6); every value is converted to UTC
- Microsecond precision is preserved with DATETIME(6)
- Your application should treat these columns as UTC (store-UTC, render-local)
- DEFAULT now() becomes DEFAULT CURRENT_TIMESTAMP(6)
Before / after
PostgreSQL
joined timestamptz DEFAULT now()
-- value: 2024-05-01 10:00:00+04 MySQL
joined DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6)
-- value: 2024-05-01 06:00:00.000000 (UTC) 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 PostgreSQL → MySQL converterSee the full type mapping table or all guides.