About 4,580,000 results
Open links in new tab
  1. Calculating days between two dates with Java - Stack Overflow

    I want a Java program that calculates days between two dates. Type the first date (German notation; with whitespaces: "dd mm yyyy") Type the second date. The program should calculates the number of...

  2. Difference Between Two Dates in Java - Baeldung

    Apr 5, 2025 · In this article, we illustrated a few ways of calculating the difference between dates (with and without time), both in plain Java as well as using external libraries. Furthermore, we calculated the difference between dates in days, and in weeks.

  3. Java, Calculate the number of days between two dates

    In Java, I want to calculate the number of days between two dates. In my database they are stored as a DATE datatype, but in my code they are strings. I want to calculate the no of days between those two strings. Note: this answer was written in 2011. I would recommend using java.time now instead of Joda Time.

  4. Find the duration of difference between two dates in Java

    Nov 24, 2022 · Use date-time mathematical formula to find the difference between two dates. It returns the years, days, hours, minutes, and seconds between the two specifies dates. Print the final result.

  5. Calculate days between two Dates in Java 8 - Stack Overflow

    Nov 19, 2014 · If you want logical calendar days, use DAYS.between() method from java.time.temporal.ChronoUnit: LocalDate dateBefore; LocalDate dateAfter; long daysBetween = ChronoUnit.DAYS.between(dateBefore, dateAfter); If you want literal 24 hour days, (a duration), you can use the Duration class instead:

  6. How to Get the Number of Days Between Dates in Java - Stack …

    May 4, 2022 · In this tutorial, learn how to calculate/get the number of days between two dates in Java - whether they're LocalDate objects, or Strings, using ChronoUnit, Joda-Time, Period, etc.

  7. JavaCalculate number of days between two dates

    Sep 11, 2022 · In this tutorial we will see how to calculate the number of days between two dates. In this program we have the dates as Strings. We first parses them into Dates and then finds the difference between them in milliseconds. Later we are convert the milliseconds into Days and displays the result as output.

  8. Number of Days between Two Dates in Java - HowToDoInJava

    Oct 15, 2024 · Learn to calculate number of days between two dates in Java 8 using ChronoUnit.DAYS.between() and LocalDate.until() methods.

  9. How to Calculate the Number of Days Between Two Dates in Java?

    Jan 1, 2023 · Calculating the number of days between two dates in Java can be accomplished by parsing the date strings into date objects and then finding the difference in days. This guide will walk you through the process using the Java 8 Date and Time API, which provides a more straightforward approach to date manipulation.

  10. Calculating Days Between Two Dates in Java – TecAdmin

    6 days ago · Java program that demonstrates how to calculate the number of days between two dates using the java.time package. This example illustrates the use of LocalDate and ChronoUnit classes from the Java 8 Date-Time API.

  11. Some results have been removed
Refresh