如何在不支持时区表的服务器上的查询中支持日期时间比较
我有这个查询:
SELECT *
FROM article
WHERE online= 1
AND IF(ISNULL(dateHOnline), dateHCreation, dateHOnline) <= Convert_TZ(Now(), "SYSTEM", "Europe/Paris")
但是 Convert_TZ(Now(),"SYSTEM","Europe/Paris")
返回 null
,可能是因为我的 mysql 服务器不支持时区表(输入 +02:00 返回日期时间)。
那么我如何修改该请求(它是一个视图)以在比较中实现夏令时功能。我想仅仅使用 +02:00
而不是 Europe/Paris
是不够的。
PS:我无法控制mysql引擎
I have this query:
SELECT *
FROM article
WHERE online= 1
AND IF(ISNULL(dateHOnline), dateHCreation, dateHOnline) <= Convert_TZ(Now(), "SYSTEM", "Europe/Paris")
But Convert_TZ(Now(),"SYSTEM","Europe/Paris")
returns null
, probably because my mysql server does not support timezone tables (putting +02:00 return a datetime).
So how can I modify that request (it's a VIEW) to implement the daylight saving feature in the comparison. I guess that just putting +02:00
instead of Europe/Paris
would not be enough.
PS : I do not have control over the mysql engine
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要做的是将时区信息加载到mysql。
What you need to do is to load timezone information into mysql.