STR_TO_DATE在mysql中解析 [英] STR_TO_DATE parsing in mysql

查看:104
本文介绍了STR_TO_DATE在mysql中解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析06/01/2010 15:00:00 08:00。

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

问题是最后一个偏移时间,mysql str_to_date 无法解析,任何想法? >

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

推荐答案

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

You need to use the CONVERT_TZ function, but you didn't specify what timezone you want to convert the 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 the ? with the appropriate timezone info.

这篇关于STR_TO_DATE在mysql中解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆