添加次数,计算总时间

发布于 2025-01-05 16:18:22 字数 112 浏览 5 评论 0原文

我尝试用时间计算一个列表。但使用 Joda Time 中的 LocalTime 我只能得到 24 小时。

使用什么正确的类来获得例如 34 小时 20 分钟 14 秒?

提前致谢

I try to calculate a List with times. But using LocalTime from Joda Time I can only get a 24 hours.

What is the right class to use to get e.g. 34hours 20minutes 14 seconds?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

So尛奶瓶 2025-01-12 16:18:22

您可能会寻找期间

Joda-Time中的时间段表示以字段定义的时间段,例如3年5个月2天7小时。这与持续时间的不同之处在于它以毫秒为单位是不精确的。周期只能通过指定其相对的时刻(包括年代和时区)来解析为精确的毫秒数。

You may be look for Period:

A period in Joda-Time represents a period of time defined in terms of fields, for example, 3 years 5 months 2 days and 7 hours. This differs from a duration in that it is inexact in terms of milliseconds. A period can only be resolved to an exact number of milliseconds by specifying the instant (including chronology and time zone) it is relative to.

合久必婚 2025-01-12 16:18:22

如果您想添加时间,这样您就可以知道中间有多少小时/秒...,如果您使用简单的毫秒计算,添加所有毫秒,然后从第一次中减去毫秒,您可能会更好,就这样,你的跨度以毫秒为单位......

If you are looking to add times, so you can tell how many hours/seconds... are in between, you would maybe be better off if you use plain miliseconds calculations, add all the miliseconds and then subsrtact the miliseconds from your first time, and there you are, you have the span in miliseconds...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文