The Unix Timestamp, while efficient for data storage, is not human-readable and appears as a set of integer numbers to the user. This lack of readability necessitates converting it into a more user-friendly format before displaying it to end-users.
If you don’t perform this conversion directly while selecting rows from the Database Table, you’ll need to handle it programmatically. For instance, in PHP, you can utilize the date()
function for conversion as follows:
$timestamp = 1690768832;
echo "date time : ".date('d-M-Y H:i:s a',$timestamp);
The above code gives the following output:
date time : 31-Jul-2023 02:00:32 am
In this tutorial, we will explore how to convert Unix Timestamp values into a more readable Date Time format when selecting data from a MySQL Database Table. Let’s dive in and make the process of converting Unix Timestamps more accessible and comprehensible.
Read more