Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

test date in java

DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MM-yyyy");
String inputString1 = "23-01-1997";
String inputString2 = "27-04-1997";

try {
    LocalDateTime date1 = LocalDate.parse(inputString1, dtf);
    LocalDateTime date2 = LocalDate.parse(inputString2, dtf);
    long daysBetween = Duration.between(date1, date2).toDays();
    System.out.println ("Days: " + daysBetween);
} catch (ParseException e) {
    e.printStackTrace();
}
Comment

PREVIOUS NEXT
Code Example
Java :: int array to map java 
Java :: how do I change the opacity of a JButton 
Java :: viewResolver 
Java :: song listening app android 
Java :: data.sql not loading in springboot 
Java :: nullpointerexception 
Java :: convert kotlin to java online 
Java :: Caused by: java.lang.ClassNotFoundException: 
Java :: Caused by: android.view.InflateException: Binary XML file line 
Java :: remove part of string java 
Java :: java arrays method 
Java :: java character in string 
Java :: java check if instance of subclass 
Java :: final method java 
Java :: convert python code to java 
Java :: java how to write something on the console with scanner 
Java :: spring cloud starter eureka client dependency 
Java :: how to find a string in a sentence in java 
Java :: java random value threadlocalrandom 
Java :: array srting line by line in textview android 
Java :: bootstrap error message 
Sql :: all workbenches in minecraft 
Sql :: create database mysql utf8 
Sql :: how to get notinteger value in sql 
Sql :: could not find driver (SQL: PRAGMA foreign_keys = ON;) 
Sql :: dbms output 
Sql :: how to remove tables from postgresql 
Sql :: date today snowflake 
Sql :: fetch first 10 rows in oracle sql developer 
Sql :: sql concate two columns first and last 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =