Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert mysql DATETIME column to epoch seconds

I have a column mysql datetime that is in DATETIME format.

Is there a way to SELECT this column in epoch seconds? If not, what would be the best way of converting the datetime format to epoch seconds? What type of field would be the best to capture this?

like image 691
David542 Avatar asked Aug 31 '25 01:08

David542


1 Answers

Use MySQL's UNIX_TIMESTAMP function

like image 85
John Conde Avatar answered Sep 02 '25 15:09

John Conde