Mean detention time is water Volume in the plant devided by flowrate. Flowrate will vary significantly over time depending on time of day, weather, etc. Volumne would be the volume of all tanks, channels etc. that take part in treatment.
Things get more complicated when you consider that part of the water leaves the plant not as cleaned wastewater but as part of the sludge.
OTOH, you could ignore the volume of the channels etc. and just add up the detention times the different processes where designed for - this will be plant dependent.