作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要将标准的长 System.currentmillis 转换为临时访问器,但不知道如何开始。
最佳答案
Instant
是一个 TemporalAccessor
,因此您可以从纪元以来的毫秒数创建一个 Instant
:
TemporalAccessor ta = Instant.ofEpochMilli(System.currentTimeMillis());
请注意 System.currentTimeMillis
的文档表示该值的粒度取决于操作系统,因此可能不是以毫秒为单位的精确时间。
Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.
关于java - 如何将 System.currentMillis 秒转换为 TemporalAccessor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55559376/
我是一名优秀的程序员,十分优秀!