类的用途
java.time.Instant
使用 Instant 的包
包
描述
提供对 Java 编程语言的设计至关重要的类。
提供对文件和文件系统属性的访问的接口和类。
提供使用 Java 编程语言访问和处理存储在数据源(通常是关系数据库)中的数据的 API。
日期、时间、瞬间和持续时间的主要 API。
用于除默认 ISO 之外的日历系统的通用 API。
支持时区及其规则。
包含集合框架、一些国际化支持类、服务加载器、属性、随机数生成、字符串解析和扫描类、base64 编码和解码、位数组和几个杂项实用程序类。
提供 Java 2 平台的核心日志记录工具的类和接口。
为并发编程定义非最终 API。
这个包提供类来创建事件和控制飞行记录器。
此包包含用于使用 Flight Recorder 数据的类。
此包包含通过 Java 管理扩展 (JMX) 控制和监视 Flight Recorder 的类。
-
Instant 在 java.lang 中的用法
-
Instant 在 java.nio.file.attribute 中的用法
java.nio.file.attribute 中返回 Instant 的方法java.nio.file.attribute 中的方法,参数类型为 Instant -
Instant 在 java.sql 中的用法
-
Instant 在 java.time 中的用法
修饰符和类型Field描述static final InstantInstant.EPOCH1970-01-01T00:00:00Z 纪元时刻的常量。static final InstantInstant.MAX最大支持Instant,'1000000000-12-31T23:59:59.999999999Z'。static final InstantInstant.MIN支持的最小值Instant,'-1000000000-01-01T00:00Z'。修饰符和类型方法描述static InstantInstant.from(TemporalAccessor temporal) 从时间对象中获取Instant的实例。abstract InstantClock.instant()获取时钟的当前时刻。InstantSource.instant()获取源的当前时刻。Instant.minus(long amountToSubtract, TemporalUnit unit) 返回此瞬间的副本,并减去指定的数量。Instant.minus(TemporalAmount amountToSubtract) 返回此瞬间的副本,并减去指定的数量。Instant.minusMillis(long millisToSubtract) 返回此瞬间的副本,并减去指定的持续时间(以毫秒为单位)。Instant.minusNanos(long nanosToSubtract) 返回此瞬间的副本,并减去以纳秒为单位的指定持续时间。Instant.minusSeconds(long secondsToSubtract) 返回此瞬间的副本,并减去指定的持续时间(以秒为单位)。static InstantInstant.now()从系统时钟获取当前时刻。static Instant从指定时钟获取当前时刻。static InstantInstant.ofEpochMilli(long epochMilli) 从 1970-01-01T00:00:00Z 的纪元开始使用毫秒获取Instant的实例。static InstantInstant.ofEpochSecond(long epochSecond) 使用 1970-01-01T00:00:00Z 纪元的秒数获取Instant的实例。static InstantInstant.ofEpochSecond(long epochSecond, long nanoAdjustment) 使用 1970-01-01T00:00:00Z 纪元的秒数和秒的纳秒小数部分获取Instant的实例。static InstantInstant.parse(CharSequence text) 从2007-12-03T10:15:30.00Z等文本字符串中获取Instant的实例。Instant.plus(long amountToAdd, TemporalUnit unit) 返回此瞬间的副本,并添加了指定的数量。Instant.plus(TemporalAmount amountToAdd) 返回此瞬间的副本,并添加了指定的数量。Instant.plusMillis(long millisToAdd) 返回此瞬间的副本,并添加指定的持续时间(以毫秒为单位)。Instant.plusNanos(long nanosToAdd) 返回此瞬间的副本,其中添加了以纳秒为单位的指定持续时间。Instant.plusSeconds(long secondsToAdd) 返回此瞬间的副本,并添加指定的持续时间(以秒为单位)。OffsetDateTime.toInstant()将此日期时间转换为Instant。Instant.truncatedTo(TemporalUnit unit) 返回截断为指定单位的此Instant的副本。Instant.with(TemporalAdjuster adjuster) 返回此瞬间的调整副本。Instant.with(TemporalField field, long newValue) 返回此瞬间的副本,并将指定字段设置为新值。修饰符和类型方法描述int将这个瞬间与指定的瞬间进行比较。static Clock获得始终返回同一时刻的时钟。static InstantSource获取始终返回同一时刻的源。boolean检查此时刻是否在指定时刻之后。boolean检查此时刻是否在指定时刻之前。static LocalDate从Instant和区域 ID 获取LocalDate的实例。static LocalDateTime从Instant和区域 ID 获取LocalDateTime的实例。static LocalTime从Instant和区域 ID 获取LocalTime的实例。static OffsetDateTime从Instant和区域 ID 获取OffsetDateTime的实例。static OffsetTime从Instant和区域 ID 获取OffsetTime的实例。static ZonedDateTime从Instant获得ZonedDateTime的实例。 -
Instant 在 java.time.chrono 中的用法
java.time.chrono 中返回 Instant 的方法修饰符和类型方法描述default InstantChronoLocalDateTime.toInstant(ZoneOffset offset) 将此日期时间转换为Instant。default InstantChronoZonedDateTime.toInstant()将此日期时间转换为Instant。java.time.chrono 中的方法,参数类型为 Instant修饰符和类型方法描述default ChronoZonedDateTime<? extends ChronoLocalDate>Chronology.zonedDateTime(Instant instant, ZoneId zone) 从Instant获得此年表中的ChronoZonedDateTime。HijrahChronology.zonedDateTime(Instant instant, ZoneId zone) IsoChronology.zonedDateTime(Instant instant, ZoneId zone) 从Instant获取此年表中的 ISO 分区日期时间。JapaneseChronology.zonedDateTime(Instant instant, ZoneId zone) MinguoChronology.zonedDateTime(Instant instant, ZoneId zone) ThaiBuddhistChronology.zonedDateTime(Instant instant, ZoneId zone) -
Instant 在 java.time.zone 中的用法
java.time.zone 中返回 Instant 的方法java.time.zone 中的方法,参数类型为 Instant修饰符和类型方法描述ZoneRules.getDaylightSavings(Instant instant) 获取此区域中指定时刻使用的夏令时量。获取这些规则中指定时刻适用的偏移量。ZoneRules.getStandardOffset(Instant instant) 获取此区域中指定时刻的标准偏移量。booleanZoneRules.isDaylightSavings(Instant instant) 检查指定的时刻是否处于夏令时。ZoneRules.nextTransition(Instant instant) 获取指定时刻后的下一个转换。ZoneRules.previousTransition(Instant instant) 获取指定时刻之前的上一个转换。 -
Instant 在 java.util 中的用法
-
Instant 在 java.util.logging 中的用法
java.util.logging 中返回 Instant 的方法java.util.logging 中的方法,参数类型为 Instant -
Instant 在 jdk.incubator.concurrent 中的用法
jdk.incubator.concurrent 中的方法,参数类型为 Instant修饰符和类型方法描述等待所有线程完成或任务范围关闭,直到给定的截止日期。等待所有线程完成或任务范围关闭,直到给定的截止日期。等待所有线程完成或任务范围关闭,直到给定的截止日期。 -
Instant 在 jdk.jfr 中的用法
-
Instant 在 jdk.jfr.consumer 中的用法
jdk.jfr.consumer 中返回 Instant 的方法修饰符和类型方法描述RecordedEvent.getEndTime()返回事件的结束时间。final InstantRecordedObject.getInstant(String name) 返回时间戳字段的值。RecordedEvent.getStartTime()返回事件的开始时间。jdk.jfr.consumer 中的方法,参数类型为 Instant修饰符和类型方法描述voidEventStream.setEndTime(Instant endTime) 指定流的结束时间。voidRecordingStream.setEndTime(Instant endTime) voidEventStream.setStartTime(Instant startTime) 指定流的开始时间。voidRecordingStream.setStartTime(Instant startTime) -
Instant 在 jdk.management.jfr 中的用法
jdk.management.jfr 中的方法,参数类型为 Instant修饰符和类型方法描述voidRemoteRecordingStream.setEndTime(Instant endTime) voidRemoteRecordingStream.setStartTime(Instant startTime)