Home >Database >Mysql Tutorial >How Can MySQL\'s FROM_UNIXTIME() Function Convert Unix Timestamps to Human-Readable Dates?
Converting Unix Timestamps to Human-Readable Dates with MySQL
Many databases use Unix timestamps to store date and time information. However, for user-facing applications, a human-readable date format is often preferred. This article explains how to use the MySQL FROM_UNIXTIME() function to easily convert Unix timestamps into a more readable format.
FROM_UNIXTIME() Function
The FROM_UNIXTIME() function takes a Unix timestamp as its argument and returns a human-readable date string. The format of the returned date string can be customized using a variety of format specifiers.
Example:
SELECT FROM_UNIXTIME(timestamp) FROM your_table;
This query will convert all Unix timestamps in the "timestamp" column of the "your_table" table to human-readable dates.
Format Specifiers:
The following format specifiers can be used to customize the output format of the FROM_UNIXTIME() function:
Examples of Formatted Output:
Additional Resources:
The above is the detailed content of How Can MySQL\'s FROM_UNIXTIME() Function Convert Unix Timestamps to Human-Readable Dates?. For more information, please follow other related articles on the PHP Chinese website!