Convert mysql DATETIME column to epoch seconds

后端 未结 2 551
旧时难觅i
旧时难觅i 2020-12-20 11:05

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 th

2条回答
  •  旧时难觅i
    2020-12-20 11:54

    You can use :

    SELECT UNIX_TIMESTAMP(yourfield) FROM yourtable;
    

    And for UPDATE, the invers function is : FROM_UNIXTIME(...)

提交回复
热议问题