Search code examples
mysqlunix-timestamp

Convert Unix timestamp into human readable date using MySQL


Is there a MySQL function which can be used to convert a Unix timestamp into a human readable date? I have one field where I save Unix times and now I want to add another field for human readable dates.


Solution

  • Use FROM_UNIXTIME():

    SELECT
      FROM_UNIXTIME(timestamp) 
    FROM 
      your_table;
    

    See also: MySQL documentation on FROM_UNIXTIME().