- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the proper way to retrieve the value stored in INT column as MySQL TIMESTAMP?
152 Lectures 16 hours
87 Lectures 5.5 hours
We can use FROM_UNIXTIME() function to retrieve the value, as MySQL TIMESTAMP, stored as INT in the column of a table.
For example, we have a table called ‘test123’ which has a column named ‘val1’. In this column, we stored the integer values as follows −
mysql> Select * from test123; +------------+ | val1 | +------------+ | 150862 | | 1508622563 | | 622556879 | | 2147483647 | +------------+ 4 rows in set (0.00 sec)
Now with the help of the FROM_UNIXTIME() function, we can retrieve the column integer values in the form of MySQL TIMESTAMP data.
mysql> Select FROM_UNIXTIME(Val1) from test123; +---------------------+ | FROM_UNIXTIME(Val1) | +---------------------+ | 1970-01-02 23:24:22 | | 2017-10-22 03:19:23 | | 1989-09-23 17:57:59 | | 2038-01-19 08:44:07 | +---------------------+ 4 rows in set (0.00 sec)
- Is there a way to retrieve the minimum value of fields in MySQL?
- What is the proper way to insert an IF statement into a MySQL query?
- What is the easiest way to convert int to string in C++
- Which is the fastest way to get a column's maximum value in MySQL?
- Insert NULL value into INT column in MySQL?
- MySQL stored procedure to return a column value?
- Simple way to toggle a value of an int field in MySQL
- Sort data column to retrieve max textual value in MySQL
- What is the proper way to define a global variable that has class scope in python?
- What is the shortest way to round to the integer value in R?
- What is the proper structure for searching within MySQL using SOUNDEX()?
- Proper way to catch exception from JSON.parse
- What is the difference between int and integer in MySQL?
- What is the way to check the size of all the MySQL databases?
- What is the easiest way to store date in MySQL database?