Commit faadedb
committed
docs(datetime): add Core Date and Time Classes diagram
What
- Added `Core Date and Time Classes.png` illustrating the core classes in the Java Date and Time API (java.time).
- Shows the hierarchy and relationships among:
- LocalDate, LocalTime, LocalDateTime (date and/or time without timezone).
- ZonedDateTime, OffsetDateTime, OffsetTime (timezone/offset aware).
- Instant (machine timestamp from epoch).
- Period and Duration (human-readable vs machine-based differences).
- Clock and ZoneId (time source and zone abstraction).
Why
- Provides a quick visual reference for understanding how the java.time API is structured.
- Helps differentiate between:
- Human-centric classes (LocalDate, Period).
- Machine-centric classes (Instant, Duration).
- Zone/offset-aware classes (ZonedDateTime, OffsetDateTime).
- Useful for learning, teaching, and onboarding developers to modern Java date/time handling.
How to use
- Open `Core Date and Time Classes.png` to explore the class hierarchy.
- Refer to it while coding with `java.time` API to choose the right class for the use case.
Real-life applications
- Choosing the correct class when:
- Storing only dates (e.g., birthdays → LocalDate).
- Working with precise machine timestamps (e.g., logging → Instant).
- Handling global scheduling (e.g., flights → ZonedDateTime).
- Calculating time spans (e.g., subscriptions → Period, Duration).
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent a30855a commit faadedb
File tree
1 file changed
+0
-0
lines changed- Section26DateandTimeAPI/Time/src
1 file changed
+0
-0
lines changed
0 commit comments