KC-135 Stratotanker has a total fuel capacity of 200,000 lbs (91,000 kg), all of which can be used by the aircraft itself; on ferry missions, for example, where the job is to just transport the aircraft from one place to another.

Fuel use is typically around 10,000 lbs per hour at 530 mph (4500 kg at 850 km/h). So a straightforward bit of arithmetic tells us that the aircraft could stay aloft for 20 hours, during which it would travel about 10,600 miles. The ferry range is given variously online as between 9500 to 11,000 miles.
The equation for endurance is pretty similar to the range equation: basically, divide the range by speed. You get 20.7 hours, or 20 hrs 42 mins. Of course, this is an extremely simplified analysis. In real life you have to account for things like wind, changing altitudes, temperature differences, fuel used during takeoff and landing including taxiing, and hundreds of other “smaller” factors that will affect one or more of the variables in the equation, so it might be a little less than what’s shown here.
Time airborne depends on the specific aircraft, its fuel tank configuration, fuel onboard, weight, ambient conditions and crew and if the plane is refueled by another tanker. Limiting factors are crew endurance, fuel quantity and fuel burn, and oil consumption.
All but the KC-135Q can use all the fuel from their refueling tanks. Some of the Q’s tanks are specifically for carrying JP-7 fuel, which is for use only on the SR-71 Blackbird, and cannot be burned by conventional jet engines. The KC-10 can refuel from KC-135’s, so in theory the answer would be “Until the food, water or toilet capacity runs out.”
I know there are actual KC-135 pilots on the site who have probably got the facts and figures at their mental fingertips, but I was curious and had a task I wanted to avoid, so I looked up the stats.

A KC-135 Stratotanker has a total fuel capacity of 200,000 lbs (91,000 kg), all of which can be used by the aircraft itself; on ferry missions, for example, where the job is to just transport the aircraft from one place to another. Compare with a standard 707 cargo plane, which had a tank capacity of ~130,000 lbs and a range of 4300 miles.
Fuel use is typically around 10,000 lbs per hour at 530 mph (4500 kg at 850 km/h). So a straightforward bit of arithmetic tells us that the aircraft could stay aloft for 20 hours, during which it would travel about 10,600 miles.
In fact, the ferry range is given variously online as between 9500–11,000 miles. The discrepancy from my simple calculation is probably down to rounding errors in fuel use estimation, I’d guess. The discrepancy in ranges online may be down to differences in the models of KC-135 used, or possibly differences in how much reserve fuel is allowed for different destinations.
