ReviseAlgo Logo

Date & Time API

9 Topics
1

Legacy Date and Time

Understand legacy date classes: java.util.Date, Calendar, and SimpleDateFormat, along with their design flaws.

Focuses on legacy concurrency bugs (SimpleDateFormat race conditions) and explaining why these classes are obsolete.
2

New Date/Time API

Overview of the JSR-310 java.time framework introduced in Java 8.

Focuses on core JSR-310 design principles: immutability, thread safety, clear separation of concerns, and timezone handling.
3

LocalDate

Work with timezone-independent dates and perform date calculations.

Tests LocalDate queries, calculations (plus/minus), and comparing dates using isBefore/isAfter.
4

LocalTime

Manage timezone-independent times and time intervals.

Tests time arithmetic, resolution limits (nanosecond precision), and conversions.
5

LocalDateTime

Combine dates and times without timezone offsets.

Tests combining LocalDate and LocalTime, and converting them to ZonedDateTime or Instant.
6

ZonedDateTime

Manage date and time with full timezone support and DST adjustments.

Commonly tested on ZoneId lookup, timezone offsets, and converting between different timezones (withZoneSameInstant).
7

Instant

Represent a specific point on the timeline with nanosecond precision.

Commonly tested on Instant timestamps, epoch seconds, and comparing instants.
8

Period and Duration

Measure date-based (Period) vs time-based (Duration) intervals.

Tests the difference between Period and Duration, and choosing the correct representation for calendar calculations.
9

Date/Time Formatting

Format and parse date-time objects using the thread-safe DateTimeFormatter.

Commonly tested on DateTimeFormatter thread safety, custom pattern syntax, and parsing strings.