如何获取日期时间字段的UTC? [英] How do you get the UTC of a datetime Field?

查看:83
本文介绍了如何获取日期时间字段的UTC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MySQL 5,并且试图将datetime字段转换为UTC_TIMESTAMP.这是我所拥有的,但无法正常工作,不确定是否可以执行此操作.但是有人可以告诉我我在做什么错吗?谢谢

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 someone please tell me what I am doing wrong? Thanks

我已经尝试过了:

SELECT
UTC_TIMESTAMP(start),
c.login_datetime as `start`
FROM
tbl_employees_login AS c

还有这个...

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

都行不通!

推荐答案

尝试使用当心:

服务器将日期(或日期时间)解释为当前时区中的值,并将其转换为UTC中的内部值.

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

这篇关于如何获取日期时间字段的UTC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆