到java.time库的最近四分之一小时还剩下多少毫秒 [英] How many milliseconds left until nearest quarter-of-an-hour with java.time library

查看:71
本文介绍了到java.time库的最近四分之一小时还剩下多少毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用java.time的Java 8中,你如何编写一个返回时间的查询,以毫秒为单位,直到最近的15分钟为止。



例如:

假设当前时间是2014-05-013T17:46:21

因此,最接近的即将到来的季度时间是2014-05-013T18 :00:00 < - 你如何在代码中写出来?



当前时间与任何其他时间之间的时间差可以使用 时间内的函数计算时间 [ ^ ]类 - 使用直到函数...

解决方案

< blockquote>你可以找到类似的要求回答这里

In Java 8 using java.time, how would you write a query that returns the amount of time in milliseconds until the nearest 15 minutes on the clock.

For example:
Suppose current time is 2014-05-013T17:46:21
Thus nearest upcoming quarter hour is 2014-05-013T18:00:00 <-- how do you write that in code?

The delta in time between the current time and any other time can be calculated using a function inside the Temporal[^] class - using the until function...

解决方案

You can find similar requirement answered here.


这篇关于到java.time库的最近四分之一小时还剩下多少毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆