Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How can I convert the epoch stored in MySQL table into readable dates?
To illustrate it we are using the following example of a table named ‘vistors’ which have the epoch as follows −
mysql> Create table visitors(userid int not null, name varchar(20), epoch int NOT NULL); Query OK, 0 rows affected (0.42 sec) mysql> Insert into visitors Values(1, 'Gaurav', 1358658942); Query OK, 1 row affected (0.04 sec) mysql> Insert into visitors Values(2, 'Raman', 1358659585); Query OK, 1 row affected (0.04 sec) mysql> Select userid, name, FROM_UNIXTIME(epoch) from visitors; +--------+--------+----------------------+ | userid | name | FROM_UNIXTIME(epoch) | +--------+--------+----------------------+ | 1 | Gaurav | 2013-07-24 16:05:42 | | 2 | Raman | 2013-07-24 16:16:25 | +--------+--------+----------------------+ 2 rows in set (0.00 sec)
Advertisements
