code: long getTimestamp(long runId, AggregationConstants.AGGREGATION_TYPE aggType) {
      if (AggregationConstants.AGGREGATION_TYPE.DAILY.equals(aggType)) {
        // get top of the hour
        long dayTimestamp = runId - (runId % Constants.MILLIS_ONE_DAY);
        return dayTimestamp;
      } else if (AggregationConstants.AGGREGATION_TYPE.WEEKLY.equals(aggType)) {
        // get top of the hour
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(runId);
        int d = c.get(Calendar.DAY_OF_WEEK);
        // get the first day of the week
        long weekTimestamp = runId - (d - 1) * Constants.MILLIS_ONE_DAY;
        // get the top of the day for that first day
        weekTimestamp = weekTimestamp - weekTimestamp % Constants.MILLIS_ONE_DAY;
        return weekTimestamp;
      }
      return 0L;
    }
docs: find out the top of the day/week timestamp
  @param runId
  @return top of the day/week timestamp