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

编程入门 行业动态 更新时间:2024-10-24 13:30:17
本文介绍了如何在Mysql中存储大于24小时的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要创建一个列(例如idletime),该列将存储小时值小于或大于24的时间值.当我尝试插入大于24的值时(对于 例如'80:00:00','129:23:12'等),正在获取以下错误代码:

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) .....

我已经在Internet上进行搜索,发现TIME数据类型的范围是00:00:00到23:59:59,并且没有达到24:00:00.

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.

推荐答案

由于异常" java.sql.SQLException "的性质,看来您的sql客户端有问题.

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

  • 在裸机控制台或另一个sqlclient中进入并尝试执行什么 你正在尝试做
  • Go in in a bare console or another sqlclient and try to execute what you were trying to do

例如:

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使用'HHH:MM:SS'格式,该格式大于24小时. 有关更多信息,请参见 doc .

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

更多推荐

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

本文发布于:2023-10-30 22:51:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:小时   时间   如何在   Mysql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!