Convert with a UTC session
SET time_zone = '+00:00';
SELECT FROM_UNIXTIME(1711972800);
SELECT UNIX_TIMESTAMP('2024-04-01 12:00:00');The first query returns April 1, 2024 at 12:00:00; the second returns 1711972800 seconds. The session time zone matters when converting a local date.
Declare default values
Avoid relying on implicit behavior of the first TIMESTAMP column, which varies by configuration and version. Declare your intention in the schema.
CREATE TABLE events (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
ON UPDATE CURRENT_TIMESTAMP(6)
);Do not assume the same limit as MySQL
The capabilities and ranges of TIMESTAMP depend on the MariaDB version. Consult the documented ranges for your version and test boundary dates. A MySQL guide does not guarantee MariaDB behavior.
A database timestamp does not contain the original time zone name. Store that name separately if your application must reconstruct a local intention, such as a recurring meeting at 09:00 in Paris.
References
English version published September 26, 2026.