The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
The core of the Date-Time API is the java.time package. 日期时间API的核心是java.time包。The classes defined in java.time base their calendar system on the ISO calendar, which is the world standard for representing date and time. java.time中定义的类将其日历系统基于ISO日历,ISO日历是表示日期和时间的世界标准。The ISO calendar follows the proleptic Gregorian rules. ISO日历遵循前公历规则。The Gregorian calendar was introduced in 1582; in the proleptic Gregorian calendar, dates are extended backwards from that time to create a consistent, unified timeline and to simplify date calculations.1582年引入了公历;在前公历中,日期从该时间向后延伸,以创建一致、一致性的时间线,并简化日期计算。
This lesson covers the following topics:本课程涵盖以下主题:
This section compares the concepts of human time and machine time provides a table of the primary temporal-based classes in the java.time package.本节比较了人工时间和机器时间的概念,并提供了java.time包中主要基于时态的类的表。
This section discusses the enum that defines the days of the week (DayOfWeek) and the enum that defines months (Month).本节讨论定义星期几(DayOfWeek)的枚举和定义月份(Month)的枚举。
This section shows the temporal-based classes that deal only with dates, without time or time zones. 本节展示了基于时态的类,这些类只处理日期,不处理时间或时区。The four classes are LocalDate, YearMonth, MonthDay and Year.这四个类是LocalDate、YearMonth、MonthDay和Year。
This section presents the LocalTime and LocalDateTime classes, which deal with time, and date and time, respectively, but without time zones.本节介绍LocalTime类和LocalDateTime类,它们分别处理时间、日期和时间,但没有时区。
This section discusses the temporal-based classes that store time zone (or time zone offset) information, ZonedDateTime, OffsetDateTime, and OffsetTime. 本节讨论存储时区(或时区偏移)信息的、基于时态的ZonedDateTime、OffsetDateTime和OffsetTime类。The supporting classes, ZoneId, ZoneRules, and ZoneOffset, are also discussed.还讨论了支持类ZoneId、ZoneRules和ZoneOffset。
This section discusses the Instant class, which represents an instantaneous moment on the timeline.本节讨论Instant类,它表示时间线上的一个瞬间。
This section provides an overview of how to use the predefined formatters to format and parse date and time values.本节概述如何使用预定义的格式化程序格式化和解析日期和时间值。
This section presents an overview of the java.time.temporal package, which supports the temporal classes, fields (TemporalField and ChronoField) and units (TemporalUnit and ChronoUnit). 本节概述java.time.temporal包,该包支持时态类、字段(TemporalField和ChronoField)和单元(TemporalUnit和ChronoUnit)。This section also explains how to use a temporal adjuster to retrieve an adjusted time value, such as "the first Tuesday after April 11", and how to perform a temporal query.本节还解释了如何使用时间调整器检索调整后的时间值,例如“4月11日后的第一个星期二”,以及如何执行时间查询。
This section explains how to calculate an amount of time, using both the Period and Duration classes, as well as the ChronoUnit.between method.本节介绍如何使用Period和Duration类以及ChronoUnit.between方法计算时间量。
This section provides a brief overview of the Clock class. 本节简要概述Clock类。You can use this class to provide an alternative clock to the system clock.可以使用此类为系统时钟提供替代时钟。
This section explains how to convert from a date in the ISO calendar system to a date in a non-ISO calendar system, such as a JapaneseDate or a ThaiBuddhistDate.本节介绍如何将ISO日历系统中的日期转换为非ISO日历系统中的日期,如JapaneseDate或ThaiBuddhistDate。
This section offers some tips on how to convert older java.util.Date and java.util.Calendar code to the Date-Time API.本节提供了一些关于如何将旧的java.util.Date和java.util.Calendar代码转换为日期时间API的技巧。
This section provides a summary of the Standard Calendar lesson.本节提供标准日历课程的摘要。