接收错误时间戳' 5/9/2022 11:09'未被认可
尝试在雪花中转换此日期格式时会出现此错误。
选择to_timestamp('5/9/2022 11:09')
时间戳记'5/9/2022 11:09'尚未确认
Gives this error when trying to convert this date format in snowflake.
SELECT TO_TIMESTAMP('5/9/2022 11:09')
Timestamp '5/9/2022 11:09' is not recognized
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您需要提供格式字符串:
这是必需的,因为5/9/2022是模棱两可的。在欧洲是9月5日。在美国是5月9日。
You need to provide a format string:
This is required because 5/9/2022 is ambiguous. In Europe it's September 5. In the US it's May 9.
您正在使用任意的时间戳格式,希望DBM会猜测它的含义。我必须承认我不能。这是5月9日还是9月5日?
您可能很幸运,DBM接受这种格式,甚至正确地猜测。但是,相反,如果依靠运气,则应向DBM提供所需的信息,即格式。或者最好仍然立即使用时间戳文字:
You are using an arbitrary timestamp format hoping the DBMS will guess what it means. I must admit I can't. Is this May 9 or September 5?
You may be lucky that the DBMS accepts this format and even guesses right. But instead if relying on luck, you should give the DBMS the information it needs, i.e. the format. Or better still use a timestamp literal right away:
因此,您“这是针对大数据集”没有意义。.
您是指数据集具有混合格式的数据吗?
在这一点上,可以使用try_函数,以按等级顺序进行尝试:
,这可以合并为一个命令要清理:
so you "this is for a large data set" does not make sense..
do you mean you data set has mixed formatted data?
at which point the TRY_ functions can be used, to try things in rank order:
and that can be merge into a single command to clean that up:
请执行查询,包括如下
select to_timestamp('5/9/2022 11:09:00');
Please execute the query including seconds like below
SELECT TO_TIMESTAMP('5/9/2022 11:09:00');
以前的MySQL版本允许使用“放松”的日期表达式。这意味着您可以在日期零件中使用任何分隔符,例如
2004@04@04@16
,2022 = 09 = 17
,<代码> 1968.04.22 ,都被认为是有效的。但是从MySQL 8.0.29开始,不再允许这一点。现在,您必须将
-
(连字符)用作定界符。您可以阅读有关更多信息
Previous MySQL versions allowed for the use of a "relaxed" date expression. This means that you could use any delimiters at all for the date parts, e.g.
2004@04@16
,2022=09=17
,1968.04.22
, were all considered to be valid.But as of MySQL 8.0.29, this is no longer allowed. You now have to use a
-
(hyphen) as the delimiter.You can read the reference manual for more information