title: How to compare dates in between query in realm android
body: <p>I am using realm database. I need to compare two dates from which i am storing in model.But the dates i am storing in string.If i use between query its throwing an error.</p>
  
  <p><strong>Error:  java.lang.IllegalArgumentException: Field 'appointmentDate': type mismatch. Was STRING, expected [INTEGER].</strong></p>
  
  <p><strong><em>json: [AppointmentBook = [{id:1},{patientID:20059},{appointmentDate:2017-07-13},{appointmentCustomerName:nitish patra},{appointmentCustomerNumber:9382882382},{appointmentStartTime:18:15},{appointmentEndTime:19:15},{reason:sass},{status:null}]]</em></strong></p>
  
  <pre><code> appoint = realm.where(AppointmentBook.class).between("appointmentDate",2017-07-13, 2017-07-14).findAll();
  </code></pre>
  
  <p>Since i am storing date as string not able to compare two dates.How to achieve this to get date which lies between "2017-07-13" to "2017-07-13".Is there any query to achieve this</p>
  
  <p>Model class:</p>
  
  <pre><code>public class AppointmentBook extends RealmObject{
  
      @PrimaryKey
      public long id;
  
  
      private long patientID;
      private String appointmentDate;
      private String appointmentCustomerName;
      private String appointmentCustomerNumber;
      private String appointmentStartTime;
      private String appointmentEndTime;
      private String reason;
      private String status;
  
  
      public AppointmentBook(){
  
      }
  
      public AppointmentBook(JsonObject data) throws ParseException {
          this.id = data.get("id").getAsLong();
          this.patientID = data.get("patientID").getAsInt();
          this.appointmentDate = data.get("appointmentDate").getAsString();
          this.appointmentCustomerName = data.get("customerName").getAsString();
          this.appointmentCustomerNumber = data.get("CustomerNumber").getAsString();
          this.appointmentStartTime = data.get("startTime").getAsString();
          this.appointmentEndTime = data.get("endTime").getAsString();
          this.reason = data.get("reason").getAsString();
          this.status = data.get("status").getAsString();
      }
  
  
  
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public long getPatientID() {
          return patientID;
      }
  
      public void setPatientID(long patientID) {
          this.patientID = patientID;
      }
  
      public String getAppointmentDate() {
          return appointmentDate;
      }
  
      public void setAppointmentDate(String appointmentDate) {
          this.appointmentDate = appointmentDate;
      }
  
      public String getAppointmentCustomerName() {
          return appointmentCustomerName;
      }
  
      public void setAppointmentCustomerName(String appointmentCustomerName) {
          this.appointmentCustomerName = appointmentCustomerName;
      }
  
      public String getAppointmentCustomerNumber() {
          return appointmentCustomerNumber;
      }
  
      public void setAppointmentCustomerNumber(String appointmentCustomerNumber) {
          this.appointmentCustomerNumber = appointmentCustomerNumber;
      }
  
      public String getAppointmentStartTime() {
          return appointmentStartTime;
      }
  
      public void setAppointmentStartTime(String appointmentStartTime) {
          this.appointmentStartTime = appointmentStartTime;
      }
  
      public String getAppointmentEndTime() {
          return appointmentEndTime;
      }
  
      public void setAppointmentEndTime(String appointmentEndTime) {
          this.appointmentEndTime = appointmentEndTime;
      }
  
      public String getReason() {
          return reason;
      }
  
      public void setReason(String reason) {
          this.reason = reason;
      }
  
      public String getStatus() {
          return status;
      }
  
      public void setStatus(String status) {
          this.status = status;
      }
  
      @Override
      public String toString() {
          return "AppointmentBook{" +
                  "id=" + id +
                  ", patientID=" + patientID +
                  ", appointmentDate='" + appointmentDate + '\'' +
                  ", appointmentCustomerName='" + appointmentCustomerName + '\'' +
                  ", appointmentCustomerNumber='" + appointmentCustomerNumber + '\'' +
                  ", appointmentStartTime='" + appointmentStartTime + '\'' +
                  ", appointmentEndTime='" + appointmentEndTime + '\'' +
                  ", reason='" + reason + '\'' +
                  ", status='" + status + '\'' +
                  '}';
      }
  
  
  }
  </code></pre>