title: Querying data between two dates from Firestore using LocalDate
body: <p>I'm trying to get orders between two chosen dates from Firestore but the problem is my query always returns 0 snapshots/documents. </p>
  
  <p>I'm using <code>LocalDate</code> class because I have a JavaFX program and the date pickers are returning LocalDate as well. I know Firestore is using its Timestamp but im not sure how to properly convert LocalDate to Firestore Timestamp. Tried using java.sql.Timestamp, but it doesnt work. Any suggestions?</p>
  
  <pre><code>private static LocalDate dateFrom, dateTo;   
  //...//
  
      Query query = null;
                  if (dateTo == null) {
                      dateTo = LocalDate.now();
  
                      Timestamp timeTo = Timestamp.valueOf(dateTo.atStartOfDay());
                      Timestamp timeFrom = Timestamp.valueOf(dateFrom.atStartOfDay());
                      query = orderRef.whereLessThanOrEqualTo("orderTimestamp", timeTo).whereGreaterThan("orderTimestamp", timeFrom);
                  } else if (dateTo.equals(dateFrom)) {
                      Timestamp timeFrom = Timestamp.valueOf(dateFrom.atStartOfDay());
                      query = orderRef.whereEqualTo("orderTimestamp", timeFrom);
                  } else {
                      Timestamp timeTo = Timestamp.valueOf(dateTo.atStartOfDay());
                      Timestamp timeFrom = Timestamp.valueOf(dateFrom.atStartOfDay());
                      query = orderRef.whereLessThanOrEqualTo("orderTimestamp", timeTo).whereGreaterThan("orderTimestamp", timeFrom);
                  }
  </code></pre>