On July 16, 1962, French geologist Michel Siffre entered a darkened cave, where he planned to remain for two months.

Tracking the days according to his sleep patterns (one night’s sleep equals one day), he believed his underground stay was ending on Aug. 20. Instead, when he emerged, it was Sept. 14 — 25 days later.

The new book “Why Time Flies” by New Yorker writer Alan Burdick explores our perception of time. Siffre spent extended periods underground three times, the last in his 60s, and showed how skewed our brain’s sense of time is without the stimuli of natural light.

“Like many scientists, Siffre wondered how a human would manage in such places, isolated from other people and from the sun,” Burdick writes.

Initially planning just a two-week stay, Siffre expanded it to two months, during which, he later said, he planned to live “like an animal, in the dark, without knowing the time.”

While not quite animalistic, his time was a test of isolation. “He pitched a tent, with a sleeping bag on a cot,” Burdick writes, noting Siffre spent his time writing, reading Plato and thinking about his future.

“He slept, rose and ate as he wished and kept a written record of his activities; a small generator powered a lamp by which he read, studied the [cave] and moved about. He was cold and his feet were perpetually wet. His only contact with the surface was by telephone, and he regularly called his colleagues above — who were under strict instruction not to betray any information about the day or time — to report his pulse rate and his proceedings.”

When he resurfaced on Sept. 14, believing it to be almost a month earlier, he accidentally “discovered something important about human biology.”

Scientists believed the human circadian cycle was precisely 24 hours long. But Siffre disproved this. “The period that Siffre was awake each day varied greatly in length, from as little as six hours to as many as 40, but on average he settled into a sleep/wake cycle that was 24 hours and 30 minutes long,” Burdick writes.

“This soon put him out of sync with the surface day, and the experience — that of an animal trapped alone with the idea of his life — unsettled him. He had descended with the aim of studying the effect of extreme isolation on the human psyche; he emerged as an unwitting pioneer of human chronobiology and, he later recalled, as ‘a half-crazed, disjointed marionette.’ ”

Ten years later, while in his 30s, Siffre repeated the experiment, this time in a Texas cave 100 feet below ground, for the longest experiment in human isolation ever undertaken.

Planning on a six-month stay, his supplies included 780 gallon jugs of water.

For the first five weeks, he later learned, he lived on a 26-hour circadian cycle. On day 37, which to him was day 30, he experienced a strange break from routine and a shift in patterns, living through an overly long day, then sleeping for 15 hours. After this, his days fluctuated wildly, from 26 hours to sometimes as long as 40 or 50.

By day 77, his hands “lost the dexterity to string beads,” and his mind could “barely string [together] thoughts.” Two days later, he called his colleagues above, begging to return, but had not even reached the halfway point. He considered suicide but decided against it because it would have left his parents with costly bills.

On day 160, he saw a mouse and, desperate for company, began plotting to capture it. Ten days later, he tried but killed it by accident. “Desolation overwhelms me,” he wrote.

The experiment ended on Aug. 10, after a full six months, as planned. He remained underground for another month alongside his colleagues who descended to administer tests. By the end, his eyesight had weakened, leaving him with a permanent squint.

Siffre began his third and final isolation experiment back in France on Nov. 30, 1999. Now 60, he wanted to see how age had affected his circadian cycle. He emerged on Feb. 14, 2000 — 76 days later, although he believed it was Feb. 5.

While his eyesight suffered and his memory was temporarily impaired, isolation in the dark had a bright side: Siffre had missed the ridiculous Y2K scare.

“While the rest of the world greeted a new millennium (and sighed in relief that their computers had not come to a crashing halt),” Burdick writes, “Siffre did nothing.”