【发布时间】:2015-06-25 18:25:47
【问题描述】:
我对此查询有疑问,无法弄清楚问题出在哪里。
我正在尝试运行:update earnings_history setDate_formatted= STR_TO_DATE(temp_date, '%m/%d/%Y'); 将我的字符串转换为日期,但出现此错误。
Error Code: 1292. Incorrect datetime value: '2015-02-29' for column 'Date_formatted' at row 5610
然而,这个查询:select temp_date from earnings_history wheretemp_dateREGEXP '[-]'; 没有找到任何行。
我使用完全不同的表格中的 %Y-%m-%d 格式,但它们似乎混合在一起?
【问题讨论】:
-
您的
earnings_history.Date_formatted类型是什么? -
我尝试了日期和日期时间
-
你不必尝试,你应该知道。那你是什么类型的?顺便说一下
temp_date? -
现在是它的日期。 Temp_date 是 varchar
标签: mysql str-to-date