MySQL Unix Timestamp

Database-focused Unix timestamp conversions for MySQL query workflows.

What is this tool?

This page explains MySQL timestamp conversion functions with practical SQL snippets that developers can copy into query editors.

How to use it

Use UNIX_TIMESTAMP for numeric output and FROM_UNIXTIME for readable output. Keep UTC strategy consistent across your application and database layers.

Examples

MySQL

-- current unix timestamp
SELECT UNIX_TIMESTAMP();

-- convert datetime to unix
SELECT UNIX_TIMESTAMP('2026-05-24 12:00:00');

-- convert unix to datetime
SELECT FROM_UNIXTIME(1779595200);

Common use cases

  • Building date filters for reports.
  • Converting audit logs for analysis.
  • Normalizing imported integration data.

FAQ

What is UNIX_TIMESTAMP in MySQL?
It returns a Unix timestamp value, commonly in seconds, from a datetime expression or current time.
How do I convert Unix time back to date in MySQL?
Use FROM_UNIXTIME to produce a readable datetime representation.