Advertisement
Guest User

Untitled

a guest
May 19th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.time.LocalDate;
  2. import java.time.format.DateTimeFormatter;
  3. import java.time.temporal.ChronoUnit;
  4. import java.util.Scanner;
  5.  
  6.  
  7. public class _07_DaysBetweenTwoDates {
  8.  
  9.     public static void main(String[] args) {
  10.        
  11.         Scanner sc = new Scanner(System.in);
  12.  
  13.         String beginDate = sc.nextLine();
  14.         String endDate = sc.nextLine();
  15.        
  16.         LocalDate start = LocalDate.parse(beginDate, DateTimeFormatter.ofPattern("d-MM-uuuu"));
  17.         LocalDate end = LocalDate.parse(endDate, DateTimeFormatter.ofPattern("d-MM-uuuu"));
  18.         long result = ChronoUnit.DAYS.between(start, end);
  19.         System.out.println(result);
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement