How do you get the UTC of a datetime Field?

后端 未结 1 1020
北海茫月
北海茫月 2021-01-29 03:46

I am using MySQL 5 and I am trying to convert a datetime field to a UTC_TIMESTAMP. Here is what I have but it\'s not working and not sure if I could even do this. But could some

1条回答
  •  遥遥无期
    2021-01-29 04:35

    Try the UNIX_TIMESTAMP() function insted:

    SELECT
      UNIX_TIMESTAMP(c.login_datetime) as `start`
    FROM
      tbl_employees_login AS c ;
    

    Beware that:

    The server interprets the date (or datetime) as a value in the current time zone and converts it to an internal value in UTC.

    0 讨论(0)
提交回复
热议问题