# 概观 > 原文: [https://docs.oracle.com/javase/tutorial/datetime/iso/overview.html](https://docs.oracle.com/javase/tutorial/datetime/iso/overview.html) 表示时间有两种基本方法。一种方式表示人类时间,称为 _ 人类时间 _,例如年,月,日,小时,分钟和秒。另一方面,_ 机器时间 _ 沿着来自原点的时间线连续测量时间,称为 _ 时期 _,以纳秒分辨率。 Date-Time 包提供了丰富的类数组,用于表示日期和时间。 Date-Time API 中的某些类用于表示机器时间,而其他类更适合表示人工时间。 首先确定您需要的日期和时间的哪些方面,然后选择满足这些需求的类或类。选择基于时间的课程时,首先要确定是否需要表示人工时间或机器时间。然后,您可以确定需要表示的时间方面。你需要一个时区吗?日期 _ 和 _ 时间?仅限日期?如果你需要约会,你需要月,日,_ 和 _ 年,还是一个子集? * * * **Terminology:** The classes in the Date-Time API that capture and work with date or time values, such as `Instant`, `LocalDateTime`, and `ZonedDateTime`, are referred to as _temporal-based_ classes (or types) throughout this tutorial. Supporting types, such as the `TemporalAdjuster` interface or the `DayOfWeek` enum, are not included in this definition. * * * 例如,您可以使用 `LocalDate` 对象来表示出生日期,因为大多数人在同一天观察他们的生日,无论他们是在他们的出生城市还是在全球的另一边。日期线。如果您正在跟踪占星时间,那么您可能希望使用 `LocalDateTime` 对象来表示出生日期和时间,或使用 `ZonedDateTime` ,其中还包括时区。如果您正在创建时间戳,那么您很可能想要使用 `Instant` ,它允许您将时间线上的一个瞬时点与另一个瞬时点进行比较。 下表总结了存储日期和/或时间信息的 `java.time` 包中基于时间的类,或者可用于测量时间量的类。列中的复选标记表示该类使用该特定类型的数据, **toString 输出**列显示使用 `toString` 方法打印的实例。 **讨论**栏目链接到教程中的相关页面。 | 类或枚举 | 年 | 月 | 天 | 小时 | 分钟 | 秒* | 区域偏移 | 区域 ID | toString 输出 | 讨论的地方 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `即时` | | | | | | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | `2013-08-20T15:16:26.355Z` | [即时班](instant.html) | | `LocalDate` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | | | | `2013-08-20` | [日期类](date.html) | | `LocalDateTime` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | `2013-08-20T08:16:26.937` | [日期和时间类](datetime.html) | | `ZonedDateTime` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | `2013-08-21T00:16:26.941 + 09:00 [亚洲/东京]` | [时区和偏移类](timezones.html) | | `LocalTime` | | | | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | `08:16:26.943` | [日期和时间类](datetime.html) | | `月日` | | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | | | | `- 08-20` | [日期类](date.html) | | `年` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | | | | | | `2013` | [日期类](date.html) | | `YearMonth` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | | | | | `2013-08` | [日期类](date.html) | | `月` | | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | | | | | `8 月` | [DayOfWeek 和月份枚举](enum.html) | | `OffsetDateTime` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | `2013-08-20T08:16:26.954-07:00` | [时区和偏移类](timezones.html) | | `偏移时间` | | | | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | `08:16:26.957-07:00` | [时区和偏移类](timezones.html) | | `持续时间` | | | ** | ** | ** | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | `PT20H` (20 小时) | [期间和持续时间](period.html) | | `期间` | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | ![checked](img/12bd475494acc0d71eb308e2275a6457.jpg) | | | | *** | *** | `P10D` (10 天) | [期间和持续时间](period.html) | | * | 秒数被捕获到纳秒级精度。 | | ** | 此类不存储此信息,但具有在这些单元中提供时间的方法。 | | *** | 当 `Period` 被添加到 `ZonedDateTime` 时,观察到夏令时或其他本地时差。 |