Category: MySQL, api

I recently ran into an issue where I was getting integer value timestamp data from an API which I simply saved into an integer column of a table. The client I was working with then decided that they needed to the integer column of timestamps to be converted into human readable DateTime.

After Googling around for quite some time I finally found an answer that worked which I think is worth sharing.

In mysql t able run one of the following queries depending on your use case: You have a 10 digit timestamp value e.g.

Then FLOOR is appliedwhich converts the number to an integer (which is what we need in the next step) by rounding down.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners