在mysql中STR_TO_DATE解析

时间:2021-06-02 16:02:10

I'm trying to parse "06/01/2010 15:00:00 08:00".

我正在解析“06/01/2010 15:00:00 08:00”。

The problem is the last offset hour, mysql str_to_date can't parse it, any idea?

问题是最后一个偏移时间,mysql str_to_date不能解析它,知道吗?

1 个解决方案

#1


4  

You need to use the CONVERT_TZ function, but you didn't specify what timezone you want to convert the datetime to:

您需要使用CONVERT_TZ函数,但没有指定要将datetime转换为:

CONVERT_TZ(STR_TO_DATE(LEFT('06/01/2010 15:00:00 08:00', 20), '%m/%e/%Y %H:%i:%s'),
           CONCAT('+', RIGHT('06/01/2010 15:00:00 08:00', 6)),
           ?)

You need to replace the ? with the appropriate timezone info.

你需要更换?有合适的时区信息。

#1


4  

You need to use the CONVERT_TZ function, but you didn't specify what timezone you want to convert the datetime to:

您需要使用CONVERT_TZ函数,但没有指定要将datetime转换为:

CONVERT_TZ(STR_TO_DATE(LEFT('06/01/2010 15:00:00 08:00', 20), '%m/%e/%Y %H:%i:%s'),
           CONCAT('+', RIGHT('06/01/2010 15:00:00 08:00', 6)),
           ?)

You need to replace the ? with the appropriate timezone info.

你需要更换?有合适的时区信息。