MySQL 时区(timezone)转换函数

    xiaoxiao2021-03-25  30

    时区(timezone)转换函数:convert_tz(dt,from_tz,to_tz)

    selectconvert_tz('2008-08-08 12:00:00', '+08:00', '+00:00'); -- 2008-08-0804:00:00

    时区转换也可以通过 date_add, date_sub, timestampadd 来实现。 select date_add('2008-08-08 12:00:00', interval -8 hour); -- 2008-08-08 04:00:00 select date_sub('2008-08-08 12:00:00', interval 8 hour); -- 2008-08-08 04:00:00 select timestampadd(hour, -8, '2008-08-08 12:00:00'); -- 2008-08-08 04:00:00
    转载请注明原文地址: https://ju.6miu.com/read-50170.html

    最新回复(0)