I have to store epoch timestamps into a MySQL database DateTime column. I need to be able to convert the epoch into the DateTime form to be able to add it to the database. The epoch data is grabbed from an external source so we have no control over that, the database is also established and should be left as it is. We just need to be able to convert between the two in PHP.
PHP
date("Y-m-d H:i:s",$epochTS);
MySQL
FROM_UNIXTIME(timestampColumn)
Nothing more to it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With