code: static long comparable(DateValue date) {
    long comp = (((((long) date.year()) << 4) + date.month()) << 5) + date.day();
      if (date instanceof TimeValue) {
        TimeValue time = (TimeValue) date;
  
        /*
         * We add 1 to comparable for timed values to make sure that timed events
         * are distinct from all-day events, in keeping with DateValue.compareTo.
         * 
         * It would be odd if an all day exclusion matched a midnight event on the
         * same day, but not one at another time of day.
         */
        return (((((comp << 5) + time.hour()) << 6) + time.minute()) << 6) + time.second() + 1;
      }
      return comp << 17;
    }
docs: Reduces a date to a value that can be easily compared to others, consistent
  with {@link DateValueImpl#compareTo}.
  @param date the date
  @return the value to use for comparisons