How to convert timestamp to datetime and datetime to timestamp in MySQL

You can use the below functions to convert the timestamp to date and date to timestamp.

timestamp to date -> from_unixtime()
date to timestamp -> unix_timestamp()

Sample uses are as follows.

Convert Timestamp to Date in MySQL

Unformatted Display

Formatted Display

Convert Date to Timestamp in MySQL

Author: dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *