Mysql-Truncated incorrect time value: '1000:59:44'
来源:互联网 发布:英语教育软件行业分析 编辑:程序博客网 时间:2024/06/07 21:58
前言:今天编写一个存储过程,条件是创建时间与当前时间相比,如果大于24小时,更新状态为失效。使用了timediff函数,出现了这个错误。记录如下;
update app_order_pay_url_info set url_status=2 where url_status=1 and HOUR(TIMEDIFF(NOW(),create_time))>24;
报如下的错误。
Truncated incorrect time value: '1000:59:44'
测试了一下,原来问题在这里:
select TIMEDIFF(NOW(),'2013-10-02 22:22:22') a,HOUR(TIMEDIFF(NOW(),'2013-10-02 22:22:22')) b;
a b
838:59:59 838
--于是改用了这个函数,来测试
select UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP('2013-11-12 22:22:22');
update app_order_pay_url_info set url_status=2 where url_status=1
and UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(create_time)>86400;
Ok,这回成功执行。
--摘录官方文档函数的解释
timediff(expr1,expr2)
timediff() returns expr1 – expr2 expressed as a time value. expr1 and expr2 are time or date-and-time expressions, but both must be of the same type.
unix_timestamp(), unix_timestamp(date)
if called with no argument, returns a unix timestamp (seconds since '1970-01-01 00:00:00' utc) as an unsigned integer. if unix_timestamp() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' utc. date may be a date string, a datetime string, a timestamp, or a number in the format yymmdd or yyyymmdd. the server interprets date as a value in the current time zone and converts it to an internal value in utc. clients can set their time zone as described in section 10.6, “Mysql server time zone support”.
- Mysql-Truncated incorrect time value: '1000:59:44'
- Mysql Truncated incorrect time value
- mysql Truncated incorrect DOUBLE value
- MySQL 报错 Truncated incorrect INTEGER value: ''
- mysql 出现 Truncated incorrect DOUBLE value:
- Truncated incorrect DOUBLE VALUE:
- Truncated incorrect DOUBLE value
- Data truncation: Truncated incorrect DOUBLE value:Mysql Update时
- 93 mysql 1292-Truncated incorrect double value 错误
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value
- Error : Truncated incorrect DOUBLE value
- mysql 1292 - Truncated incorrect INTEGER
- Data truncation: Truncated incorrect DOUBLE value
- Data truncation: Truncated incorrect DOUBLE value: 'Y'
- Data truncation: Truncated incorrect DOUBLE value: 'xiaodi'
- Data truncation: Truncated incorrect DOUBLE value
- Mybatis Data truncation: Truncated incorrect DOUBLE value: '*'
- 服务器上的错误报告 显示
- mysql prepare语句使用
- rqnoj-314-[NOIP2000]方格取数-多线程dp
- SQLSERVER 创建ODBC 报错的解决办法 SQLState:'01000'
- 使用opencv 录摄像头数据到文件
- Mysql-Truncated incorrect time value: '1000:59:44'
- LoadRunner简单应用之:win/websockets通信中获取服务器返回数据
- Linux 主机名被修改成bogon问题
- mysql学习入门
- Java中的Timer和TimerTask的使用
- Java根据sessionId获取Session对象
- 系统偏好-共享-web sharing 无法打开,黄灯一闪即灭
- Drainage Ditches
- string类介绍