You're asking a very simple question that has a remarkably complex answer
The internet has never seen a world war. In fact, the 40 years in which the internet has existed—and the mere 20 in which it has been widely used—have been anomalously peaceful in the long view of human history. What conflicts have arisen have been relatively local in scope: skirmishes, cross-border conflicts and internal civil unrest. And these conflicts have reliably resulted in local disruptions to the internet. If local conflicts cause local internet disruptions, what sorts of disruptions would global conflicts cause? (Source)
The "global Internet" is, as a phrase, a fantasy. The Internet is highly complex in countries and areas like Europe, the U.S., and Finland. And it's nothing more than smartphones on a cell network in many third-world countries. Even in a country like the U.S., "the Internet" is something quite a bit different between rural and urban areas, in the densely populated East vs. the Midwest. And let's not even mention the difference between military/government connectivity and citizen-grade connectivity. It's often a temptation to believe that globally everyone can do what I do when in reality the "global Internet" isn't nearly as global as one might think.
To understand the internet during a world war, let’s begin with a more popular topic: internet fragmentation. Broadly, this term refers to the sense that the internet is growing increasingly different in different countries. As our measurements show, internet fragmentation is a real phenomenon, though its form is considerably more complex than popular narratives of illiberal internets rising to threaten a supposedly global one.
What fragmentation we observe is not solely the maneuverings of an ascendant illiberal order, but also a global response to an internet whose management by policymakers no longer (and perhaps never did) align perfectly with the strategic interests of all the world’s nations. Popular narratives of “cyber conflict” focus on the “domain” reading, framing the internet as a medium through which conflict occurs; but it is equally an effect of conflict. The internet is, in other words, not only the domain but also the object of international competition and co-operation. (ibid.)
By the way, you should read the entirety of the article I'm quoting. It won't directly answer your question, but it will give you an idea of why your question is both important and remarkably difficult to answer with a single objective number.
In other words, the global Internet is already hugely at risk simply because it's not uniformly the same level of technology, the same level of maintenance, the same level of security or the same level of reliability everywhere in the world. But it's worse than that. Just s few days ago Yemen's Houthi rebels attacked a ship. As it sank, it destroyed three of fourteen international telecommunications cables. Did it bring down the global Internet? No. It did cause some grief, but the remaining eleven cables (and other routes) were used to reroute the data.
This suggests that the "global Internet" is reasonably resilient to some problems. Unfortunately, the ability to power the Internet isn't one of them. The internet in areas served by nuclear power would survive longer than areas served by hydroelectric power — and that would survive longer than areas served by coal or propane power. Some localized sections of the Internet (notably rural or more sparsely populated) are shifting to solar power.
What this means is that if your measure of success is "given every operating Internet node today and ignoring all outages currently in progress, how many would be operating after everybody disappeared?" Answer: immediately, all of them. After a day or two, some of them. After a week or more only a small portion of them — some of which will be international in nature. Some will collapse faster than others due to the weather in the area at the time (colder areas depend on more energy and thus will deplete faster). Others still will depend on whether or not major storms that depend on human maintenance to keep everything running have occurred.
You ask about automatic re-routing. Yes, that ability exists to a degree, but explaining all the ins-and-outs of how the Internet is managed top-to-bottom is well beyond the scope of this site.
From a worldbuilding perspective, what does this mean?
It means that between technologically advanced countries, you can depend on a day, maybe a week, and could believably rationalize months. From a storybuilding perspective, you simply need to ensure the right kind of conditions (hydroelectric, dams, moderate weather, etc.) exist to justify your choice of time.
The problem is that between two arbitrary points it's next to impossible to argue how long the Internet would remain running. E.G., between my house and the house of someone in Annecy, France. Between government/military centers it is easy it would remain active for a very long time. Between major cities, not as long. Between rural Texas and rural Egypt, maybe an hour. The Internet is too fractured for better estimates than that and the idea of a "global Internet" is actually quite meaningless.
Out of curiosity, why do you care?
Suppose all people are incapacitated or disappear.
Nobody is around to care if the Internet is running or not. Why, then, does it matter how long it stays running?