使用Java计算日期之间的秒数差异

huangapple go评论76阅读模式
英文:

Finding the difference between dates in seconds using java

问题

我卡在java.time.temporal.ChronoUnitjava.time.temporal.Temporal until之间。它们是如何工作的?

英文:

I'm stuck between java.time.temporal.ChronoUnit and java.time.temporal.Temporal until. How do they work??

答案1

得分: 2

查看ChronoUnitTemporalUnit的Javadoc。

ChronoUnit枚举基本上提供了一些标准的TemporalUnit,但其他开发人员也可以实现其他的TemporalUnit

例如,您可以编写以下代码:

TemporalUnit u = ChronoUnit.DAYS;

但您也可以通过扩展ChronoUnit来创建新的TemporalUnit

英文:

Look at the javadoc for ChronoUnit and TemporalUntit.

The ChronoUnit enum basically provides some standard TemporalUnits but other developers could implement other TemporalUnits.

For example, you can write the following code:

TemporalUnit u=ChronoUnit.DAYS;

but you can also create new TemporalUnits by extending ChronoUnit.

huangapple
  • 本文由 发表于 2020年8月9日 00:17:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/63317638.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定