做常规时:
select convert_tz(now(), "UTC", "Europe/London")
直接在 MariaDB 服务器上,它将产生:
+-------------------------------------------+
| convert_tz(now(), "UTC", "Europe/London") |
+-------------------------------------------+
| 2013-03-07 16:01:32 |
+-------------------------------------------+
但如果通过 ruby 1.8.7 或 1.9.3 宽度完成:
q = 'select convert_tz(now(), "UTC", "Europe/London")'
ActiveRecord::Base.connection.select_all(q)
它将产生:
"convert_tz(now(), \"UTC\", \"Europe/London\")" => nil
对 MySQL 设置执行相同操作:
q = 'select convert_tz(now(), "UTC", "Europe/London")'
ActiveRecord::Base.connection.select_all(q)
结果是:
"convert_tz(now(), \"UTC\", \"Europe/London\")" => "2013-03-07 16:05:14"
现在在 MySQLWorkbench 中测试,同样的错误结果在那里发生,返回 null 而不是转换后的时间。
所以我想这是 MariaDB 中的东西还是?