Converting negative values from FROM_UNIXTIME

后端 未结 2 2075
感情败类
感情败类 2020-12-01 22:31

I have been trying to convert Date of birth from my DB into DATE FORMat but i am facing the problem of there are some negative values in DOB fields which when i check from o

2条回答
  •  失恋的感觉
    2020-12-01 22:55

    From DATETIME to unix timestamp:

    SELECT TIMESTAMPDIFF(SECOND, FROM_UNIXTIME(0), '1956-12-24 01:06:49');

    From timestamp to DATETIME:

    SELECT DATE_ADD(convert_tz(FROM_UNIXTIME(0), @@session.time_zone,'+00:00'), INTERVAL -410914391 SECOND);

提交回复
热议问题