mysql 24小时_如何在Mysql中存储大于24小时的时间?

bd96500e110b49cbb3cd949968f18be7.png

I need to create a column (say idletime) that will store time value having hours smaller or bigger than 24. When i try to insert such values bigger than 24 (For

example '80:00:00', '129:23:12', etc) , am getting the following error code:

java.sql.SQLException: Illegal hour value '80' for java.sql.Time type in value '80:00:00.

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)

.....

I have searched over the Internet and found that the TIME datatype ranges from 00:00:00 to 23:59:59 and does not reach 24:00:00.

Is there any solution available for my problem? Am executing this insert query within a stored procedure.

解决方案

It seems that you have a problem from your sql client because of the nature of the exception "java.sql.SQLException".

Go in in a bare console or another sqlclient and try to execute what

you were trying to do

for example:

CREATE Table mytimetable (testtime TIME);

Insert into mytimetable values ('1:1:1'),('080:1:1'),('80:1:1');

select * from mytimetable ;

01:01:01

80:01:01

80:01:01

MySQL uses the 'HHH:MM:SS' format, which is larger than 24 hours.

See doc for more

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值