docs: public static final long parseDateTimeString(final String datetime, 
        final String tz) {
      if (datetime == null || datetime.isEmpty())
        return -1;
  
      if (datetime.matches("^[0-9]+ms$")) {
        return Tags.parseLong(datetime.replaceFirst("^([0-9]+)(ms)$", "$1"));
      }
  
      if (datetime.toLowerCase().equals("now")) {
        return System.currentTimeMillis();
      }
  
      if (datetime.toLowerCase().endsWith("-ago")) {
        long interval = DateTime.parseDuration(
          datetime.substring(0, datetime.length() - 4));
        return System.currentTimeMillis() - interval;
      }
      
      if (datetime.contains("/") || datetime.contains(":")) {
        try {
          SimpleDateFormat fmt = null;
          switch (datetime.length()) {
            // these were pulled from cliQuery but don't work as intended since 
            // they assume a date of 1970/01/01. Can be fixed but may not be worth
            // it
            // case 5:
            //   fmt = new SimpleDateFormat("HH:mm");
            //   break;
            // case 8:
            //   fmt = new SimpleDateFormat("HH:mm:ss");
            //   break;
            case 10:
              fmt = new SimpleDateFormat("yyyy/MM/dd");
              break;
            case 16:
              if (datetime.contains("-"))
                fmt = new SimpleDateFormat("yyyy/MM/dd-HH:mm");
              else
                fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm");
              break;
            case 19:
              if (datetime.contains("-"))
                fmt = new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss");
              else
                fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
              break;
            default:
              // todo - deal with internationalization, other time formats
              throw new IllegalArgumentException("Invalid absolute date: " 
                  + datetime);
          }
          if (tz != null && !tz.isEmpty())
            setTimeZone(fmt, tz);
          return fmt.parse(datetime).getTime();
        } catch (ParseException e) {
          throw new IllegalArgumentException("Invalid date: " + datetime  
              + ". " + e.getMessage());
        }
      } else {
        try {
          long time;
          final boolean contains_dot = datetime.contains(".");
          // [0-9]{10} ten digits
          // \\. a dot
          // [0-9]{1,3} one to three digits
          final boolean valid_dotted_ms = 
              datetime.matches("^[0-9]{10}\\.[0-9]{1,3}$");
          if (contains_dot) {
            if (!valid_dotted_ms) {
              throw new IllegalArgumentException("Invalid time: " + datetime  
                  + ". Millisecond timestamps must be in the format "
                  + "<seconds>.<ms> where the milliseconds are limited to 3 digits");
            }
            time = Tags.parseLong(datetime.replace(".", ""));   
          } else {
            time = Tags.parseLong(datetime);
          }
          if (time < 0) {
            throw new IllegalArgumentException("Invalid time: " + datetime  
                + ". Negative timestamps are not supported.");
          }
          // this is a nasty hack to determine if the incoming request is
          // in seconds or milliseconds. This will work until November 2286
          if (datetime.length() <= 10) {
            time *= 1000;
          }
          return time;
        } catch (NumberFormatException e) {
          throw new IllegalArgumentException("Invalid time: " + datetime  
              + ". " + e.getMessage());
        }
      }
    }