Specify Persistence Timeframe

I’ve been doing some research on this, but apparently haven’t hit upon the right combination of words to return any results.

Is it possible to specify a time frame when requesting the max value of an item from (ex.) two days ago between the hours of 6am to 6pm?

Using the example below, I am currently able to do this for the full day using the following:

var Number numCount = (maxCount.historicState(now.minusDays(2).withTime(23,55,55,55))).state as DecimalType

I can see how I could adjust the withTime value down to match 6pm, but I only want the max value between 6a and 6p.

Thanks for any guidance you might have,

Brian