Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

find number of days between two local dates in java 8

Days between two dates
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
 
public class DaysBetweenDates 
{
  public static void main(String[] args) 
  {
    LocalDate date1 = LocalDate.now();
    LocalDate date2 = date1.plusDays(99);
     
    long diffInDays = ChronoUnit.DAYS.between(date1, date2);
     
    System.out.println(diffInDays);  // 99
  }
}
Comment

java days between two localdate

LocalDate dateBefore;
LocalDate dateAfter;
long daysBetween = DAYS.between(dateBefore, dateAfter);
Comment

PREVIOUS NEXT
Code Example
Java :: A horizontal line must be drawn through the diamond, centered vertically. • The message must be printed just above the line. • The message must be horizontally centered within the applet 
Java :: prime check jaba 
Java :: java getdeclaredfield private field 
Java :: new int [] in java with assigned values 
Java :: java copy list 
Java :: java string to int 
Java :: difference between premitive and non-premitive 
Java :: Why is it not recommended to use script elements in jsp? 
Java :: convert string to char array in java 
Java :: make recycler view non scrollable 
Java :: hql return new object from query 
Java :: plus one leetcode java 
Java :: dialog box in java swing 
Java :: java convert array to another type 
Java :: list to lowercase java 
Java :: null character in java 
Java :: go to activity android 
Java :: in a junit test how test if empty list is returned 
Java :: programmation android avoir acces à la liste des intents de partage 
Java :: how to collect objective in java 
Java :: how to compare 3 numbers in java 
Java :: module-info.java module not found 
Java :: Rxjava dependencies 
Java :: check if string is null or empty java 
Java :: java button 
Java :: status codes springboot 
Java :: print a to z in java 
Java :: find duplicate value in array using java 
Java :: java int to hex 
Java :: java.lang.ExceptionInInitializerError: null 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =