Parsing STR_TO_DATE in mysql

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

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

+3
source share
1 answer

You need to use the CONVERT_TZ function , but you did not specify which time zone you want to convert datetime to:

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 ?with the relevant time zone information.

+4
source

Source: https://habr.com/ru/post/1749981/


All Articles