Date Comparison

Java date time

Difference between ZonedDateTime and OffsetDateTime

Learn about ZonedDateTime and OffsetDateTime classes in Java, and what are the main differences between both classes in depth. 1. Understanding Zone Id and Zone Offsets Before jumping to the internals of the classes, let’s make sure we understand the difference between the zone identifier and zone offsets. Most programming languages measure the time from …

Compare Two LocalDateTime Instances

Learn to compare two LocalDateTime instances to find out which date represents an older timestamp in comparison to other timestamp. LocalDateTime class is part of java.time package added in Java 8.

Compare Two LocalDate Instances in Java

Learn to compare two LocalDate instances to find out which date represents an older date in comparison to second date. LocalDate class is part of java.time package added in Java 8.

Compare Two ZonedDateTime Instances

Learn to compare two instances of ZonedDateTime either in the same timezone or in different timezones in Java 8. 2. Comparing at Same Instant As we know an instance of ZonedDateTime is a point in the universal timeline with an offset. So to compare two such instances, logically, both instances …

Compare Two Dates in Java

Learn to compare two given dates in Java to find out which date is earlier and which is later in the universal timeline. We will see date comparison examples using the following classes: 1. Date Comparison since Java 8 1.1. Core Classes The most used date classes in Java 8 …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.