SELECT (from_time user_offset) as start FROM `availabilities`;
我正在尝试将当前登录用户的时区偏移量添加到我正在获取的时间列值中。
from_time 的值会像02:30:00
,offset 的值会像+02:00
有谁知道什么是合适的方法。
UPDATE:
我尝试了以下方法:
SELECT id, TIME_FORMAT( (
TIME_FORMAT( from_time, '%H:%i' ) + '05:30' ) , '%H:%i'
) AS
START
FROM `availabilities`;
我得到了00:00
,但值应该是02:00
,因为 from_time 的值是20:30
我什至试过
SELECT
id,
CONVERT_TZ(
from_time,
'+00:00',
'+05:30'
) AS `start`
FROM availabilities
But it works only if **from_time field has both date and time, for time it returns null**