Mammals swapped nightlife for daytime after dinosaurs died off around 66 million years ago, a new study suggests.
The research supports the theory that the common ancestor to all mammals was nocturnal to stay safe from dinosaurs, who were were primarily active during the day.
Scientists studied the behaviour of 2,415 species of mammals alive today and then used computer algorithms to recreate the way their ancestors lived millions of years ago.
The results suggest mammals switched to daytime activity shortly after the dinosaurs were wiped out around 65.8 million years ago.
Study leader Roi Maor, a PhD student at Tel Aviv University, said: "Our study shows for the first time a very close correlation between the time dinosaurs disappeared and the time mammals first started to be active during the day.
"Mammals' ancestral nocturnality itself is not surprising and has been supported by previous studies, but the correlation in timing between the disappearance of dinosaurs and the advent of daytime activity in mammals has not been shown before."
The study showed that the even-toed ungulates - mammals with two weight-bearing toes on each foot such as camels, hippo, antelopes and sheep - were the first to change their behaviour, which occurred 200,000 years after the dinosaurs became extinct.
And simian primates - such as gorillas, gibbons and tamarins - were among the first to give up nighttime activity altogether.
Mr Maor said: "The common ancestor of all monkeys and apes may have been the first mammal to forgo nocturnal activity altogether, some 52 million or 33 million years ago.
"These primates, including humans, are the only mammals that evolved adaptations to seeing well in daylight."
The researchers state their findings point to a strong correlation but cannot say whether the dinosaurs dying off was the reason why the behaviour of the mammals changed.
The study is published in Nature Ecology & Evolution.