DATE_FORMAT(FROM_UNIXTIME(`user.registration`), '%e %b %Y') AS 'date_formatted'
Answer from Yatin on Stack OverflowHow to convert timestamp to datetime in MySQL? - Stack Overflow
Convert MySQL datetime to timestamp - Stack Overflow
Convert Unix timestamp into human readable date using MySQL - Stack Overflow
Timestamp to date
What does converting a timestamp to a date mean in SQL?
What is the easiest way to convert a timestamp to a date?
Why is timestamp-to-date conversion useful in real projects?
Videos
Use the FROM_UNIXTIME() function in MySQL
Remember that if you are using a framework that stores it in milliseconds (for example Java's timestamp) you have to divide by 1000 to obtain the right Unix time in seconds.
DATE_FORMAT(FROM_UNIXTIME(`orderdate`), '%Y-%m-%d %H:%i:%s') as "Date" FROM `orders`
This is the ultimate solution if the given date is in encoded format like 1300464000
UPDATE table1 A, table2 B SET B.date_added=UNIX_TIMESTAMP(A.date_added) WHERE A.id=B.id;
UNIX_TIMESTAMP('2015-01-15 12:00:00');
is sufficient to convert a mysql datetime to a Timestamp.
Try this please:
UPDATE table1 A, table2 B
SET B.date_added = FROM_UNIXTIME(A.date_added)
WHERE A.id=B.id
Reference. It seems like you have an issue with the way you format date stammp. Also please look into this post: Should I use field 'datetime' or 'timestamp'?
Use FROM_UNIXTIME():
SELECT
FROM_UNIXTIME(timestamp)
FROM
your_table;
See also: MySQL documentation on FROM_UNIXTIME().
What's missing from the other answers (as of this writing) and not directly obvious is that from_unixtime can take a second parameter to specify the format like so:
SELECT
from_unixtime(timestamp, '%Y %D %M %H:%i:%s')
FROM
your_table