Browse by Topic

Popular

Latest

Latest Java Posts

Illustration of two calendar dates separated by a period of time in Java
Java

Java Period Between Two Dates

How to use Java's Period.between to compute the calendar difference between two LocalDate values as years, months, and days, with examples and edge cases.

java.timePeriodLocalDatedate arithmetic
Comparison of Java date objects showing LocalDate, ZonedDateTime, and Instant with a timeline.
Java

Java Date Comparison: Legacy vs java.time

Learn how to compare dates in Java using java.util.Date and java.time, including LocalDate, ZonedDateTime, and Instant, with practical examples.

java.timeLocalDateDate comparisonZonedDateTime
Illustration of a calendar date being moved backward by a number of days using LocalDate.minusDays() in Java.
Java

Java LocalDate minusDays: Subtract Days from a Date

Learn how to subtract days from a Java LocalDate using minusDays(), including boundary handling, negative arguments, and immutable behavior.

LocalDatejava.timedate arithmeticimmutability
A calendar page with a highlighted date moving forward by one day, illustrating LocalDate.plusDays in Java
Java

Using LocalDate.plusDays in Java

Learn how LocalDate.plusDays works, why it returns a new instance, and how to handle month boundaries, negative values, and overflow in Java.

LocalDateJava Date APIDate ArithmeticImmutability
A Java DateTimeFormatter converting a date object to a formatted string and back.
Java

Java DateTimeFormatter: Formatting and Parsing Dates

Learn how to use Java's DateTimeFormatter to format and parse dates and times, including pattern letters, builder usage, thread safety, locales, and common pitfalls.

DateTimeFormatterJava time APIdate formattingdate parsing
Illustration of formatting a LocalDate object into a string using DateTimeFormatter in Java.
Java

Java LocalDate Format: Patterns and Examples

Learn how to format a Java LocalDate with DateTimeFormatter, including predefined and custom patterns, locale handling, parsing, and common pitfalls.

LocalDateDateTimeFormatterJava TimeDate Parsing
Illustration of parsing a date string into a LocalDate object in Java
Java

Java LocalDate parse: Converting Strings to Dates

Learn how to parse strings into LocalDate using DateTimeFormatter, handle invalid inputs, and avoid common pitfalls in Java.

LocalDateDateTimeFormatterdate parsingJava date time
A calendar icon with a clock and a Java logo, representing getting the current date with LocalDate.now()
Java

Java LocalDate.now(): Get the Current Date

Learn how LocalDate.now() gets the current date in Java, including time zone handling, formatting, thread safety, and common pitfalls.

JavaLocalDatejava.timecurrent date
A split illustration showing a traditional calendar icon on one side and a modern date picker on the other, representing the difference between java.util.Date and LocalDate.
Java

Java Date vs LocalDate: Choosing the Right Type

Learn the core difference between java.util.Date and java.time.LocalDate, when to use each, and how to convert between them safely.

java.timeLocalDatejava.util.Datedate conversion
Illustration of a calendar with a period arrow between two dates, representing the Java Period class for date-based amounts.
Java

Java Period: Date-Based Amounts in java.time

Use java.time.Period to represent date-based amounts in years, months, and days, including creation, arithmetic, normalization, and differences from Duration.

java.timePerioddate arithmetictemporal API