将时间跨度存储在MySQL数据库中的最佳方法?

编程入门 行业动态 更新时间:2024-10-25 16:25:36
本文介绍了将时间跨度存储在MySQL数据库中的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在mysql数据库中存储某些内容的时间,例如某时间所花费的时间,例如2小时,5分钟,10秒.精度低至秒是首选,但不是必需的.最好的方法是什么?

I'd like to store an amount of time for something in a mysql database,for the length of time something took, such as 2 hours, 5 minutes, 10 seconds. accuracy down to the second is preferred, but not required. What's the best way to go about doing this?

推荐答案

MySQL TIME 类型可以存储从'-838:59:59'到'838:59:59'的时间跨度-如果在您要求的范围内,那么让MySQL在本地显示这些跨度会很有用HH:MM:SS表单,然后使用该表单.

A MySQL TIME type can store time spans from '-838:59:59' to '838:59:59' - if that's within your required range, and it would be useful to have MySQL natively present these spans in HH:MM:SS form, then use that.

否则,我将使用整数类型来表示秒数.

Otherwise, I'd just go with an integer type to represent the number of seconds.

更多推荐

将时间跨度存储在MySQL数据库中的最佳方法?

本文发布于:2023-10-23 06:09:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1520023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:跨度   数据库中   时间   方法   MySQL

发布评论

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

>www.elefans.com

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