Guest User

randomDate Java Method

a guest
Apr 25th, 2022
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. public LocalDate RandomDate() {
  2.         LocalDate startDate = LocalDate.of(1990, 1, 1); //start date
  3.  
  4.         LocalDate endDate = LocalDate.now(); //end date
  5.        
  6.         LocalDate newFecha=ThreadLocalRandom.current().longs(startDate, endDate).findAny().getAsLong();
  7.         return newFecha;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment