- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert UNIX timestamp into human readable format in MySQL?
To convert UNIX timestamp into a human-readable format, use the FROM_UNIXTIME() method.
Let us first create a table −
mysql> create table timeConversionDemo -> ( -> dateTimeConversion bigint -> ); Query OK, 0 rows affected (0.45 sec)
Following is the query to insert records in the table using insert command −
mysql> insert into timeConversionDemo values(1554316200); Query OK, 1 row affected (0.14 sec) mysql> insert into timeConversionDemo values(1546194600); Query OK, 1 row affected (0.22 sec) mysql> insert into timeConversionDemo values(1511548200 ); Query OK, 1 row affected (0.21 sec)
Following is the query to display all records from the table using select statement −
mysql> select * from timeConversionDemo;
This will produce the following output −
+--------------------+ | dateTimeConversion | +--------------------+ | 1554316200 | | 1546194600 | | 1511548200 | +--------------------+ 3 rows in set (0.00 sec)
Here is the query to convert −
mysql> select FROM_UNIXTIME(dateTimeConversion,'%d-%m-%Y') AS Conversion from timeConversionDemo;
This will produce the following output −
+------------+ | Conversion | +------------+ | 04-04-2019 | | 31-12-2018 | | 25-11-2017 | +------------+ 3 rows in set (0.00 sec)
Following is the query if you want it in the MySQL date format −
mysql> select FROM_UNIXTIME(dateTimeConversion,'%Y-%m-%d') AS Conversion from timeConversionDemo;
This will produce the following output −
+------------+ | Conversion | +------------+ | 2019-04-04 | | 2018-12-31 | | 2017-11-25 | +------------+ 3 rows in set (0.00 sec)
- Related Articles
- Convert MySQL Unix-Timestamp format to date format?
- Convert MySQL timestamp to UNIX Timestamp?
- How to convert unix timestamp string to readable date in Python?
- How to convert from Unix timestamp to MySQL timestamp value?
- How to convert MySQL datetime to Unix timestamp?
- MySQL - Convert YYYY-MM-DD to UNIX timestamp
- Convert MM/DD/YY to Unix timestamp in MySQL?
- Implement ORDER BY in MySQL to order records in human readable format?
- Convert dd/mm/yyyy string to Unix timestamp in MySQL?
- Convert string (varchar) to timestamp format in MySQL?
- How to convert Python date to Unix timestamp?
- How to convert a Unix timestamp to time in JavaScript?
- How can I convert the epoch stored in MySQL table into readable dates?
- How to make numbers 'human readable' in MySQL?
- In MySQL, how can I convert a number of seconds into TIMESTAMP?

Advertisements