A long-standing theory holds that the common ancestor to all mammals was nocturnal, but the new discovery reveals when the mammals started living in the daytime for the first time.
It also provides insight into which species changed behaviour first.
Researchers from University College London (UCL) in the UK and Tel Aviv University's Steinhardt Museum of Natural History in Israel analysed data of 2,415 species of mammals alive today.
Two different mammalian family trees portraying alternative timelines for the evolution of mammals were used in the analysis.
More From This Section
The results, published in the journal Nature Ecology and Evolution, show that mammals switched to daytime activity shortly after the dinosaurs had disappeared.
This change did not happen in an instant - it involved an intermediate stage of mixed day and night activity over millions of years, which coincided with the events that decimated the dinosaurs.
"We were very surprised to find such close correlation between the disappearance of dinosaurs and the beginning of daytime activity in mammals, but we found the same result unanimously using several alternative analyses," said Roi Maor, a PhD student at UCL.
However, the two evolutionary timelines varied, giving a window between 52-33 million years ago for this to have occurred.
This discovery fits well with the fact that simian primates are the only mammals that have evolved adaptations to seeing well in daylight.
The visual acuity and colour perception of simians is comparable to those of diurnal reptiles and birds - groups that never left the daytime niche.
"It's very difficult to relate behaviour changes in mammals that lived so long ago to ecological conditions at the time, so we can't say that the dinosaurs dying out caused mammals to start being active in the daytime. However, we see a clear correlation in our findings," said Kate Jones from UCL.