     else
       return { type: 'and', filters }
 
-rangeToDruidInterval = (interval) ->
-  return interval.map((d) -> d.toISOString().replace('Z', '')).join('/')
-
 
 class DruidQueryBuilder
   @ALL_DATA_CHUNKS = 10000
   @allTimeInterval = ["1000-01-01/3000-01-01"]
+
+  @dateToIntervalPart = (date) ->
+    return date.toISOString()
+      .replace('Z',    '') # remove Z
+      .replace('.000', '') # millis if 0
+      .replace(/:00$/, '') # remove seconds if 0
+      .replace(/:00$/, '') # remove minutes if 0
+      .replace(/T00$/, '') # remove hours if 0
 
   constructor: (@dataSource, @timeAttribute, @forceInterval, @approximate) ->
     throw new Error("must have a dataSource") unless typeof @dataSource is 'string'

        throw new Error("filter type '#{filter.type}' not defined")

  addFilter: (filter) ->
    return unless filter
    [@filter, intervals] = @filterToDruid(filter)
    if intervals
      @intervals = intervals.map((({start, end}) -> "#{@dateToIntervalPart(start)}/#{@dateToIntervalPart(end)}"), this)
    return this

  addSplit: (split) ->


      queryObj = druidQuery.getQuery()
    catch e
      callback(e)
      return

    requester queryObj, (err, ds) ->
